Subject: | |
From: | |
Reply To: | |
Date: | Thu, 2 Aug 2007 21:06:53 -0400 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Every example I've seen looks basically like this:
for i in `cat somefile`
do
echo $i
done
But this only works if the lines have no whitespace in them, which
doesn't exactly describe most of the files I'm trying to work with
(log files, to be specific), because i ends up being each word
instead of each line.
I could pipe the output from cat to sed and replace the whitespace
with a character not found in log files and then replace those
characters with whitespace before processing them, but that seems
like a waste of time to me. (Actually, that pretty much sums up my
impression of shell scripting so far, but I have something I need to
accomplish with it, unfortunately.)
BTW, can anyone recommend a good book on shell scripting for someone
who doesn't intend to make a career of it--just get a few things
done? I've done about all I can with man pages.
Thanks!
|
|
|