Date: Mon, 15 Oct 2001 03:28:39 +0200 From: Cliff Sarginson <cliff@raggedclown.net> To: freebsd-questions@FreeBSD.ORG Subject: Re: sh script question Message-ID: <20011015032839.A2423@raggedclown.net> In-Reply-To: <Pine.BSF.4.21.0110142012320.23659-100000@pemaquid.safeport.com>; from doug@safeport.com on Sun, Oct 14, 2001 at 09:09:30PM -0400 References: <Pine.BSF.4.21.0110142012320.23659-100000@pemaquid.safeport.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Oct 14, 2001 at 09:09:30PM -0400, doug@safeport.com wrote:
> 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.
>
It is possible...
IFS="
"
Where obviously you hit the <enter> key straight after the
opening "
--
Regards
Cliff
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?20011015032839.A2423>
