[KLUG Members] To shell or not to shell...
goose@knbpower.com
members@kalamazoolinux.org
Mon, 15 Jul 2002 15:07:44 -0400
>I'm trying to figure out how I can process this export file
>one line at a time in a shell script, but I'm starting to
>think I can't. I'm thinking I need to write a little C
>program to read each line into an array, walk through it
>as necessary, and write out to the text files. I'd rather
>do it with bash, but am failing to find how. Everything I
>read about I/O with shell scripts is just redirection.
>Nthing on how to open a file for reading line by line.
This just might help you.... I ls -al a directory into a temp file, then
read it back to extract filenames to transmit via email. Hopes this helps...
#!/bin/bash
while read temp; do
echo -n "sending $temp to ec.up.com "
cat $temp | mail -s **EDI** UPTEDI@ec.up.com
echo "Done"
mv $temp sent
let num=num+1
sleep 5
done < /tmp/ra96e
The read command will pickup the line from the file /tmp/ra96e one line
at a time and continues until it reaches the eof.
Goose
P.S. Sorry this took so long to reply to... I'm WAY behind on emails!!!!
--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .