LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-10-2003, 03:14 PM   #1
brian0918
Member
 
Registered: Apr 2003
Posts: 87

Rep: Reputation: 15
file progress


I have files that are updated multiple times a minute and would like an extremely easy way to check on their progress. Within one of these files, the progress is repeatedly being appended (along with other stuff) to the end of the file, in a line that looks like this:

----------- Iteration 123 ------------

Is there a way to have a script (or something) look for this line at the bottom of the file, and if it finds it, to output it somehow (either in the shell window, or in the titlebar of the shell window, or something), and constantly check it and update it?

Thanks.


Also - the files are completed at a known iteration value (like 500 or 1000 or something), and so this script could stop when this value is reached (it could be an input parameter possibly)

Last edited by brian0918; 06-10-2003 at 03:21 PM.
 
Old 06-10-2003, 03:45 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
erm, get root-tail (an app the print output directly onto your desktop background) and have it run "tail -f /blah/file" the -f makes it continually read the very end of the file as it is appended.
 
Old 06-10-2003, 03:47 PM   #3
brian0918
Member
 
Registered: Apr 2003
Posts: 87

Original Poster
Rep: Reputation: 15
I don't want the entire file printed out, because a lot of data is also printed out (besides the Iteration line). Is there a way to have it only print out the most recent lines that include "Iteration"
 
Old 06-10-2003, 03:51 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
when did i ever say that that would print out the entire file? i did acutally say it will read "the very end".

if you only want a certain line, grep the output of tail.
 
Old 06-10-2003, 04:45 PM   #5
mhearn
LQ Guru
 
Registered: Nov 2002
Location: Durham, England
Distribution: Fedora Core 4
Posts: 1,565

Rep: Reputation: 47
tail -f foo

that will "follow" the file
 
Old 06-10-2003, 05:39 PM   #6
brian0918
Member
 
Registered: Apr 2003
Posts: 87

Original Poster
Rep: Reputation: 15
Is there a way to do it so it does the same thing that tail -f does, but only outputs lines that contain "Iteration" if and when those new lines are written to the file.
 
Old 06-11-2003, 04:25 AM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
Please try to read replies a little more carefully
Quote:
if you only want a certain line, grep the output of tail.
 
Old 06-11-2003, 09:00 AM   #8
brian0918
Member
 
Registered: Apr 2003
Posts: 87

Original Poster
Rep: Reputation: 15
Yes, but how do I get that to constantly update and output, just like how tail -f does it
 
Old 06-11-2003, 09:01 AM   #9
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
ok, so you don't actaully know what a pipe even is? ok....

tail -f /some/file | grep blah

that WILL do exactly what you have asked.
 
Old 06-11-2003, 09:21 AM   #10
brian0918
Member
 
Registered: Apr 2003
Posts: 87

Original Poster
Rep: Reputation: 15
ok, so you don't actaully know what a pipe even is? ok....

oops sorry, guess i should post in the newbie forum next time... my bad
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to display file copy progress bar bmcneely0 Linux - General 12 02-19-2012 03:19 PM
Some progress - but need more help mrh7184 Linux - Wireless Networking 1 10-04-2005 06:58 AM
gui file copy progress indicator? zero79 Linux - Software 3 07-10-2005 02:00 AM
How the Progress Bar of a copy file/directory process is progressed?(any logic)? kiranprashant Programming 3 03-08-2005 06:16 AM
file progress in xterm titlebar with bash brian0918 Linux - Newbie 3 06-11-2003 06:04 PM


All times are GMT -5. The time now is 05:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration