grep file

Steve Buehler steve at ibapp.com
Wed Apr 14 13:10:50 UTC 2004


Not sure what mailing list I need to join to ask this question, so I will 
ask it here in the hopes of getting a good response.  I am trying to get a 
specific line out of a file that changes size regularly using a shell 
script (#!/bin/sh).  I use the following command:
/bin/cat $BACKUPLOG|grep "Downloaded: ">>$BACKUPLOG'2'
Of course $BACKUPLOG and $BACKUPLOG'2' refer to a couple of files.  For 
some reason, it will pull out lines that are NOT part of the line that has 
"Downloaded: " in it.  The other lines do have the word "Downloaded" in 
them, but not the colon and space after it.  I was wondering if it would be 
easier to tell it just to cat the 2nd line from the end of the file.  That 
is where the line is always at.  Problem is, I do not know how to do 
this.  I hope that someone has an idea on this and would be kind enough to 
send me the correction.

Thanks
Steve





More information about the redhat-list mailing list