RE: 'print' output on one line

2004-01-06 Thread Esposito, Anthony
Very helpful...thank you

Tony Esposito
Oracle Developer, Enterprise Business Intelligence
XO Communications
Plano, TX  75074
Work Phone: 972-516-5344
Work Cell: 972-670-6144
Email: [EMAIL PROTECTED]


-Original Message-
From: R. Joseph Newton [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 06, 2004 5:07 PM
To: Esposito, Anthony
Cc: Jenda Krynicky; [EMAIL PROTECTED]
Subject: Re: 'print' output on one line

"Esposito, Anthony" wrote:

> I tried that already but it just gives me the final count at the end.  I would like 
> the output to change - the row count, that is - as each 100 rows is committed with 
> the final output - when the program ends - to be:

Try turning autoflush on:

Greetings! C:\>perl -w
{
  local $| = 1;
  print "Hello, there\r";
  sleep 2;
  print "Well, bye for now\r";
  sleep 2;
}

^Z
Hello, there

[two seconds later...]
Greetings! C:\>perl -w
{
  local $| = 1;
  print "Hello, there\r";
  sleep 2;
  print "Well, bye for now\r";
  sleep 2;
}

^Z
Well, bye for now

HTH,

Joseph


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: 'print' output on one line

2004-01-06 Thread R. Joseph Newton
"Esposito, Anthony" wrote:

> I tried that already but it just gives me the final count at the end.  I would like 
> the output to change - the row count, that is - as each 100 rows is committed with 
> the final output - when the program ends - to be:

Try turning autoflush on:

Greetings! C:\>perl -w
{
  local $| = 1;
  print "Hello, there\r";
  sleep 2;
  print "Well, bye for now\r";
  sleep 2;
}

^Z
Hello, there

[two seconds later...]
Greetings! C:\>perl -w
{
  local $| = 1;
  print "Hello, there\r";
  sleep 2;
  print "Well, bye for now\r";
  sleep 2;
}

^Z
Well, bye for now

HTH,

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: 'print' output on one line (thread closed)

2004-01-06 Thread Esposito, Anthony
Alright, gents, you and I were both right..."\r" works, as it should.
It turns out that these computers today - and Perl - are even faster than I thought.  
My test data set was only 300 rows so by the time the program ran - and deleted - 300 
rows the Perl program had only enough time to print the output once, making it 
'appear' to not work.  I had a suspicion that that may be the problem so I increased 
my test data set to 6000 and it worked fine.
Thanks all!

Close this thread.

:-)

Tony Esposito
Oracle Developer, Enterprise Business Intelligence
XO Communications
Plano, TX  75074
Work Phone: 972-516-5344
Work Cell: 972-670-6144
Email: [EMAIL PROTECTED]


-Original Message-
From: Esposito, Anthony 
Sent: Tuesday, January 06, 2004 3:09 PM
To: Jenda Krynicky; [EMAIL PROTECTED]
Subject: RE: 'print' output on one line

I tried that already but it just gives me the final count at the end.  I would like 
the output to change - the row count, that is - as each 100 rows is committed with the 
final output - when the program ends - to be:

INFO 3: start deleting rows.

Rows deleted: 400

INFO 4: delete_rows.pl program ended.

In other words, as time goes by, you see on your screen:

INFO 3: start deleting rows.

Rows deleted: 100

then ( overwriting the above )

INFO 3: start deleting rows.

Rows deleted: 200

and so on until the end...

Tony Esposito
Oracle Developer, Enterprise Business Intelligence
XO Communications
Plano, TX  75074
Work Phone: 972-516-5344
Work Cell: 972-670-6144
Email: [EMAIL PROTECTED]


-Original Message-
From: Jenda Krynicky [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 06, 2004 2:59 PM
To: [EMAIL PROTECTED]
Subject: Re: 'print' output on one line

From: "Esposito, Anthony" <[EMAIL PROTECTED]>
> I have a perl program ( with DBI ) which prints out a line to STDOUT
> after every 100 database commits.  I would like the 'print' to just
> refresh the current line every time but - not knowing how to get
> around it - the program instead prints a new line every 100 commits
> like so:
> 
> INFO 3: start deleting rows.
> Rows deleted: 100
> Rows deleted: 200
> Rows deleted: 300
> Rows deleted: 400
> ...
> print "Rows deleted: $rows_deleted\n";

Use \r instead of \n:

print "Rows deleted: $rows_deleted\r";

> 
> $row_counter = 0;
> 
> }
> 
> }
> 
> print "INFO 4: $0 program ended.\n";

and don't forget to add a \n in front of the "INFO 4..."

HTH, Jenda

= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: 'print' output on one line

2004-01-06 Thread Patrick Shoaf
The issue of printing to the same location is based on terminal type.  You 
have several options on how you can implement this scenario.

1) from a text environment, you could use the codes for the proper terminal 
type to reposition the cursor before sending your next print statement.

2) you could also leave the \n off the end of line, use the \b to 
backspace, then display the next data, ex.
print "Help";   #Display Help
print "\b\b\b"; #Backspace 3 times;
print "ip Hop"; #Display should now read "Hop Hop"
print "\n"; # start a new line

3) you could use a visual programming language and be able to directly 
control the cursor location and position in a window environment.

4) you could use perl and some modules to write code for the windowing 
environments.

At 03:53 PM 1/6/2004, Esposito, Anthony wrote:
I have a perl program ( with DBI ) which prints out a line to STDOUT
after every 100 database commits.  I would like the 'print' to just
refresh the current line every time but - not knowing how to get around
it - the program instead prints a new line every 100 commits like so:


INFO 3: start deleting rows.

Rows deleted: 100

Rows deleted: 200

Rows deleted: 300

Rows deleted: 400

.

.

.

INFO 4: delete_rows.pl program ended.



I would like the output to just stay on one line and just update the
count as the program proceeds.  So the output - when done - would just
be


INFO 3: start deleting rows.

Rows deleted: 400

INFO 4: delete_rows.pl program ended.



Is there a 'print' option/escape character the sends the file pointer (
for STDOUT in this case ) back to the beginning of the line?


Here is the current code segment - the focus here is on the last 'print'
statement:


print "INFO 3: start deleting rows.\n";

while(($row_data) = $sth1->fetchrow) {

  if(! defined ($sth2->execute($row_data))) {   # execute DELETE

print "ERROR 4: execute of DELETE statement failed.\n";

exit(int 4);

  }

  $row_counter = $row_counter + 1;

  if($row_counter >= 100) {

$dbh->commit;

$rows_deleted = $rows_deleted + $row_counter;

print "Rows deleted: $rows_deleted\n";

$row_counter = 0;

}

}

print "INFO 4: $0 program ended.\n";



  Thanks for any help you can offer



Tony Esposito

Oracle Developer, Enterprise Business Intelligence

XO Communications

Plano, TX  75074

Work Phone: 972-516-5344

Work Cell: 972-670-6144

Email: [EMAIL PROTECTED]


Patrick J. Shoaf, IT Manager
[EMAIL PROTECTED]
Model Cleaners, Uniforms, & Apparel
100 Third Street
Charleroi, PA 15022
http://www.model-uniforms.com
Phone: 724-489-9553 ext. 105
 or800-99 MODEL
Fax:   724-489-4386


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



RE: 'print' output on one line

2004-01-06 Thread Esposito, Anthony
I tried that already but it just gives me the final count at the end.  I would like 
the output to change - the row count, that is - as each 100 rows is committed with the 
final output - when the program ends - to be:

INFO 3: start deleting rows.

Rows deleted: 400

INFO 4: delete_rows.pl program ended.

In other words, as time goes by, you see on your screen:

INFO 3: start deleting rows.

Rows deleted: 100

then ( overwriting the above )

INFO 3: start deleting rows.

Rows deleted: 200

and so on until the end...

Tony Esposito
Oracle Developer, Enterprise Business Intelligence
XO Communications
Plano, TX  75074
Work Phone: 972-516-5344
Work Cell: 972-670-6144
Email: [EMAIL PROTECTED]


-Original Message-
From: Jenda Krynicky [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 06, 2004 2:59 PM
To: [EMAIL PROTECTED]
Subject: Re: 'print' output on one line

From: "Esposito, Anthony" <[EMAIL PROTECTED]>
> I have a perl program ( with DBI ) which prints out a line to STDOUT
> after every 100 database commits.  I would like the 'print' to just
> refresh the current line every time but - not knowing how to get
> around it - the program instead prints a new line every 100 commits
> like so:
> 
> INFO 3: start deleting rows.
> Rows deleted: 100
> Rows deleted: 200
> Rows deleted: 300
> Rows deleted: 400
> ...
> print "Rows deleted: $rows_deleted\n";

Use \r instead of \n:

print "Rows deleted: $rows_deleted\r";

> 
> $row_counter = 0;
> 
> }
> 
> }
> 
> print "INFO 4: $0 program ended.\n";

and don't forget to add a \n in front of the "INFO 4..."

HTH, Jenda

= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: 'print' output on one line

2004-01-06 Thread James Edward Gray II
On Jan 6, 2004, at 2:53 PM, Esposito, Anthony wrote:

Is there a 'print' option/escape character the sends the file pointer (
for STDOUT in this case ) back to the beginning of the line?
Sure is.  Try ending your lines with a "\r" instead of a "\n".  Works 
on Unix at least.

James

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: 'print' output on one line

2004-01-06 Thread Jenda Krynicky
From: "Esposito, Anthony" <[EMAIL PROTECTED]>
> I have a perl program ( with DBI ) which prints out a line to STDOUT
> after every 100 database commits.  I would like the 'print' to just
> refresh the current line every time but - not knowing how to get
> around it - the program instead prints a new line every 100 commits
> like so:
> 
> INFO 3: start deleting rows.
> Rows deleted: 100
> Rows deleted: 200
> Rows deleted: 300
> Rows deleted: 400
> ...
> print "Rows deleted: $rows_deleted\n";

Use \r instead of \n:

print "Rows deleted: $rows_deleted\r";

> 
> $row_counter = 0;
> 
> }
> 
> }
> 
> print "INFO 4: $0 program ended.\n";

and don't forget to add a \n in front of the "INFO 4..."

HTH, Jenda

= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: 'print' output on one line

2004-01-06 Thread Esposito, Anthony
Errata:  The "last" print statement in the 'while' loop is the focus..

Tony Esposito
Oracle Developer, Enterprise Business Intelligence
XO Communications
Plano, TX  75074
Work Phone: 972-516-5344
Work Cell: 972-670-6144
Email: [EMAIL PROTECTED]


-Original Message-
From: Esposito, Anthony 
Sent: Tuesday, January 06, 2004 2:54 PM
To: [EMAIL PROTECTED]
Subject: 'print' output on one line

I have a perl program ( with DBI ) which prints out a line to STDOUT
after every 100 database commits.  I would like the 'print' to just
refresh the current line every time but - not knowing how to get around
it - the program instead prints a new line every 100 commits like so:

 

INFO 3: start deleting rows.

Rows deleted: 100

Rows deleted: 200

Rows deleted: 300

Rows deleted: 400

.

.

.

INFO 4: delete_rows.pl program ended.

 

I would like the output to just stay on one line and just update the
count as the program proceeds.  So the output - when done - would just
be 

 

INFO 3: start deleting rows.

Rows deleted: 400

INFO 4: delete_rows.pl program ended.

 

Is there a 'print' option/escape character the sends the file pointer (
for STDOUT in this case ) back to the beginning of the line?

 

Here is the current code segment - the focus here is on the last 'print'
statement:

 

print "INFO 3: start deleting rows.\n";

while(($row_data) = $sth1->fetchrow) {

  if(! defined ($sth2->execute($row_data))) {   # execute DELETE

print "ERROR 4: execute of DELETE statement failed.\n";

exit(int 4);

  }

  $row_counter = $row_counter + 1;

  if($row_counter >= 100) {

$dbh->commit;

$rows_deleted = $rows_deleted + $row_counter;

print "Rows deleted: $rows_deleted\n";

$row_counter = 0;

}

}

print "INFO 4: $0 program ended.\n";

 

  Thanks for any help you can offer

 

Tony Esposito

Oracle Developer, Enterprise Business Intelligence

XO Communications

Plano, TX  75074

Work Phone: 972-516-5344

Work Cell: 972-670-6144

Email: [EMAIL PROTECTED] 

 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




'print' output on one line

2004-01-06 Thread Esposito, Anthony
I have a perl program ( with DBI ) which prints out a line to STDOUT
after every 100 database commits.  I would like the 'print' to just
refresh the current line every time but - not knowing how to get around
it - the program instead prints a new line every 100 commits like so:

 

INFO 3: start deleting rows.

Rows deleted: 100

Rows deleted: 200

Rows deleted: 300

Rows deleted: 400

.

.

.

INFO 4: delete_rows.pl program ended.

 

I would like the output to just stay on one line and just update the
count as the program proceeds.  So the output - when done - would just
be 

 

INFO 3: start deleting rows.

Rows deleted: 400

INFO 4: delete_rows.pl program ended.

 

Is there a 'print' option/escape character the sends the file pointer (
for STDOUT in this case ) back to the beginning of the line?

 

Here is the current code segment - the focus here is on the last 'print'
statement:

 

print "INFO 3: start deleting rows.\n";

while(($row_data) = $sth1->fetchrow) {

  if(! defined ($sth2->execute($row_data))) {   # execute DELETE

print "ERROR 4: execute of DELETE statement failed.\n";

exit(int 4);

  }

  $row_counter = $row_counter + 1;

  if($row_counter >= 100) {

$dbh->commit;

$rows_deleted = $rows_deleted + $row_counter;

print "Rows deleted: $rows_deleted\n";

$row_counter = 0;

}

}

print "INFO 4: $0 program ended.\n";

 

  Thanks for any help you can offer

 

Tony Esposito

Oracle Developer, Enterprise Business Intelligence

XO Communications

Plano, TX  75074

Work Phone: 972-516-5344

Work Cell: 972-670-6144

Email: [EMAIL PROTECTED]