Re: for command

From: Coyle, Jack (Jack.Coyle@REXHEALTH.COM)
Date: Thu Nov 06 2003 - 09:15:42 EST


If the use of the "for" construct is not a requirement, the following will
do what you want:

        cat testfile | while read line ; do
            echo $line
        done

Regards,

Jack Coyle
Rex Healthcare
(919) 784-3792
jack.coyle@rexhealth.com

> ----------
> From: John Dunn[SMTP:john.dunn@SEFAS.CO.UK]
> Reply To: IBM AIX Discussion List
> Sent: Thursday, November 06, 2003 9:10 AM
> To: aix-l@Princeton.EDU
> Subject: for command
>
> Given the following data how do I get the following script to echo each
> line, rather than each string?
>
> for line in `cat testfile`
> do
> echo $line
> done
>
>
> testfile =
>
> hhhh jjjjjjj kkkkkkkkk
> ggggg lllllll mmmmmm
> sssss kkkkk llllll
>
>



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:17:20 EDT