procmail
[Top] [All Lists]

Sed question

1999-10-01 12:08:00
Hi,

Hope this sed question isn't too offtopic, but....

I want to grab individual lines of text with sed to be filtered/parsed
from text files coming in through my SmartList/Procmail setup.

So far I want to:

line=`sed -n -e ' '$count'p' < file.txt`

This is fine, I can increment $count to go get the next line when
I am ready for it. Trouble is I don't know when file.txt runs out
of lines. If I have $count set to 50 but there is only 49 lines in 
file.txt, is there an error code I can check so I know I have reached
the end of file.txt?

While I am here, it seems reading lines from file.txt one at a time 
might generate alot of disk accesses. Is there a way to pull file.txt
into a variable and have  sed grap lines from the variable, or can
sed only read files on the disk?

Thanks!

--Paul T.

-- 
Windows98 (noun): 32 bit extensions and a graphical shell for a 16 bit
patch to an 8 bit operating system originally coded for a 4 bit
microprocessor, written by a 2 bit company, that can't stand 1 bit of
competition.

<Prev in Thread] Current Thread [Next in Thread>