Simple Perl Script to Screen Display


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Simple Perl Script to Screen Display
# 1  
Old 04-19-2002
Simple Perl Script to Screen Display


$number_clients++;

print("Creating client $number_clients\r");


I have been using the above to increment on the screen as the script increments throughout a while loop. What I would like to know is what is the trick to keep the last one on the screen without printing it again?

Ie

...Script running

Creating client 500

End of script

At the moment it runs through and just removes the last one from the screen....

Thanks in anticipation, I am sure it is a simple answer...
Shakey21
# 2  
Old 04-19-2002
I haven't seem a simple way around the problem (although, it is interesting to note that under Win32 with ActiveState the \r is not a problem although it is under Unix).

How about something like this?

Code:
#!/usr/bin/perl

my $counter = 0;

while ($counter++ <= 1000) {
  print "Counter is $counter";

  # Doing lots of work that takes a while

  print "\r"
};
print "\nDone!\n";

When the creating takes a while the message is still displayed on the line and the carriage return doesn't take place until the work is done and ready for the next iteration.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help making simple perl or bash script to create a simple matrix

Hello all! This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician. Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix: ... (16 Replies)
Discussion started by: torchij
16 Replies

2. Shell Programming and Scripting

Hopefully a simple script, bash or perl...

I'm attempting to parse a file whose contents follow this format; 4:/eula.1028.txt: 8:/eula.1031.txt: 19:/eula.1033.txt: 23:/eula.1036.txt: 27:/eula.1040.txt: 31:/eula.1041.txt: 35:/eula.1042.txt: 39:/eula.2052.txt: 43:/eula.3082.txt: The number of lines of the file... (4 Replies)
Discussion started by: CudaPrime
4 Replies

3. Shell Programming and Scripting

Run a bash script, display on the screen and save all information in a file including error info

Hi all, How to: Run a bash script, display on the screen and save all information in a file including error information. For example: I have a bash script called test.sh now I want to run the test.sh and display the output on the screen and save the output including error info to a file. ... (1 Reply)
Discussion started by: Damon sine
1 Replies

4. Homework & Coursework Questions

Help with Simple Perl/Python Script

I have the following problem, which I need done in Perl/ or Python using Unix/linux filters... 1. You have a very large file, named 'ColCheckMe', tab-delmited, that you are asked to process. You are told that each line in 'ColCheckMe' has 7 columns, and that the values... (1 Reply)
Discussion started by: Swapnilsagarwal
1 Replies

5. Shell Programming and Scripting

Help with Simple Perl/Python Script

I have the following problem, which I need done in Perl/ or Python using Unix/linux filters... 1. You have a very large file, named 'ColCheckMe', tab-delmited, that you are asked to process. You are told that each line in 'ColCheckMe' has 7 columns, and that the values in the... (1 Reply)
Discussion started by: Swapnilsagarwal
1 Replies

6. UNIX for Dummies Questions & Answers

Not able to run the simple perl script

Hi Experts, I have written simple perl script, which assign the value to variable and print it. Following is the script: $ cat 3.pl #!/usr/bin/env ksh #!/usr/bin/perl print "Hello World"; $iputlne = 34; print $iputlne; The error output is: $ /usr/bin/env perl 3.pl Hello World... (9 Replies)
Discussion started by: Amey Joshi
9 Replies

7. Shell Programming and Scripting

shell script that adds two integers and display answer on screen

please help shell script that adds two intergers and display answer on screen (1 Reply)
Discussion started by: wanyac2
1 Replies

8. Shell Programming and Scripting

screen display help

Hello All, I have a file that is formatted like this 1234556 1234567 1234588 1123888 1999999 1010101 1919191 1919191.... for a total of 26000 + lines how do I get a script to read lets say 50 lines at a time and display the output to the screen in column format around 5 or 6... (2 Replies)
Discussion started by: zilla30066
2 Replies

9. Shell Programming and Scripting

simple perl script not working

why won't below work? I am trying to see a)sipfile has username of the system. b)it will read the sipfile and do a grep function against the /etc/passwd c)it will save that output to /tmp/result.. but my script is just hanging... #!/usr/bin/perl -w open(SIPFILE, "</tmp/sipfile") ... (4 Replies)
Discussion started by: hankooknara
4 Replies

10. Shell Programming and Scripting

controlling screen display

How can I control the screen output when trying to read a large file onto the screen x number of lines at a time. I'm trying to use this is a bourne shell script. I want to display 10 lines of a file, pause the screen so that a user can read the file, and then display the next 10 lines of the file,... (6 Replies)
Discussion started by: jrdnoland1
6 Replies
Login or Register to Ask a Question