On Wed, Jun 07, 2006 at 11:56:46AM -0700, Menachem Shapiro wrote:
> B"H
> On 6/7/06, John Oliver <[EMAIL PROTECTED]> wrote:
> >When I use the output of catting a file as the variable in a for-then
> >loop, the output of cat is broken along all spaces. So, a line in a
> >file like:
> >
> >71.112.211.167 - - [01/Jun/2006:00:03:06 -0700] "GET
> >/BENBRYAN-NEIL-BENB-RYAN-IMPACTENGINE/44/44211E9A-8412-61EC-E6F2-CC89F84887F6/gallery/image/9844/image.swf
> >HTTP/1.1" 200 4151 "-"
> >
> >when called out like:
> >
> >for i in $(cat /tmp/test.log); do echo $i; done
> >
>
> >Why, and how do I keep the line whole?
> >
>
> Try this:
>
> -----
> for i in $(cat /tmp/test.log); do echo "$i"; done
> -----
It turned out that I needed to use "while read line", like:
cat /tmp/testlog | while read line;
do echo "${line}";
done
--
***********************************************************************
* John Oliver http://www.john-oliver.net/ *
* *
***********************************************************************
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list