2006. július 19. 16:31,
Mladen Adamovic <[EMAIL PROTECTED]>
-> Debian User <debian-user@lists.debian.org>,:
> Tony Terlecki wrote:
> >> Is there a shell command to read files?  I want to open a text file,
> >> loop through each line and parse the line of text.
> >
> > Depending on what you want to do:
> >
> > man sed
> > man awk
>
> Yeah, but he asked about shell commands which read files, and that is 'cat'
> so my addon to your answer is : see also 'man cat'
"The purpose of cat is to concatenate (or "catenate") files. If it's only one 
file, concatenating it with nothing at all is a waste of time, and costs you 
a process." — Randal L. Schwartz
>
> In bash script you might  use something like
> for i in $(cat yourfile);
> do
>         do_something_with $i
> done
>

http://sial.org/howto/shell/useless-cat/

In a bash script you should use something like this:

for i in $(<yourfile)
do
        do_something_with $i
done


Daniel

-- 
LeVA

Reply via email to