[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Reading through files
"Gregory L. Snead" <gsnead@harlequin.com> writes:
> I have a file that I want
>to read through one line at a time and perform some type of
>operation in es using the data read in.
rittle@comm.mot.com (Loren James Rittle) replies:
> Here is a
> quick example:
>
> for (i= `` \n {cat /etc/passwd})
Ugh. Well, it works, and it's what I use, but
it's lousy for use in scripts; es already takes up
enough memory without snarfing a whole file (including
putting it into the environment), when you only want
to look at it one line at a time.
This is something that used to come up on the list a
lot when es first escaped (:-)), and I'm not tremendously
happy with the final results - which, as it happens, I
can't remember anyway.
One method was to use line. Problem is, you can't tell
if you've read a blank line or reached the end. This is
my main bug-bear with rc/es. When I used rc, I used to
hack each release so that I could do:
while (x = `line) {
something_with $x
}
as you can do with the Bourne shell. I haven't bothered
with es - I've just used Perl when I know I'm going to
be processing arbitrarily large files.
Sigh. I'd still like access to the status of `prog...
steve