Date: Sun, 14 Oct 2001 21:09:30 -0400 (EDT) From: <doug@safeport.com> To: freebsd-questions@FreeBSD.ORG Subject: sh script question Message-ID: <Pine.BSF.4.21.0110142012320.23659-100000@pemaquid.safeport.com>
next in thread | raw e-mail | index | archive | help
I want to read a file line-wise. The following:
_______________
#!/bin/sh
USER="doug"
FILE="newuser.form"
if [ ! -e ${FILE:-$1} ]; then
echo "File: ${FILE:-$1} not found"
exit 1
fi
for Line in `cat ${FILE:-$1}`; do
echo $Line
done
---------------
gives the file a field per read. The field delimiter being blank/whitespace. The
obvious answer would seem to be "IFS=<newline>" but I can not figure out the
syntax or even if that is possible.
Thanks for any pointers
_____
Douglas Denault
doug@safeport.com
Voice: 301-469-8766
Fax: 301-469-0601
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0110142012320.23659-100000>
