OT: Need some shell scripting hints ;)
Atro Tossavainen
yellowdog-general@lists.terrasoftsolutions.com
Thu Oct 2 01:38:01 2003
> I'm stuck with writing a shell script that is supposed to read a text
> file line by line.
Use the "read" command in the shell.
#!/bin/sh
while read x
do
some stuff with $x
done
Run this as "script < file"
Using "read" gets rid of the annoying problem in Nathan's suggestion
that Konstantin pointed out that a "for" loop over `cat $file` would
not loop over entire lines, but instead over whitespace-separated
words in those lines too.
--
Atro Tossavainen (Mr.) / The Institute of Biotechnology at
Systems Analyst, Techno-Amish & / the University of Helsinki, Finland,
+358-9-19158939 UNIX Dinosaur / employs me, but my opinions are my own.
< URL : http : / / www . helsinki . fi / %7E atossava / >
File attachments NOT welcome unless agreed to beforehand.