<quote who="Howard Lowndes">

> I want to process a text file a line at a time, but I want the entire line
> to be assigned to a variable rather than each non-whitespace character
> string in each line.  Something like:
> 
> for i in $(cat filename); do echo $i; done       Which don't work.:(

# cat the file to a while loop
# while loops on the command 'read i'
#   which reads a line-entry from stdin into the variable $i
# while finishes when read returns an error

cat filename | while read i
do
    echo $i;
done

- Jeff

-- 
    "Learning and doing is the true spirit of free software -- learning     
   without doing gets you academic sterility, and doing without learning    
    is all too often the way things are done in proprietary software." -    
                                Raph Levien                                 
-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to