From owner-freebsd-questions Mon May 31 21:52:28 1999 Delivered-To: freebsd-questions@freebsd.org Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (Postfix) with ESMTP id AD15715385 for ; Mon, 31 May 1999 21:52:23 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.9.3/8.9.3) id XAA62646; Mon, 31 May 1999 23:52:22 -0500 (CDT) (envelope-from dan) Date: Mon, 31 May 1999 23:52:21 -0500 From: Dan Nelson To: Greg Pavelcak Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Stupid /bin/sh Script Question Message-ID: <19990531235221.A62559@dan.emsphone.com> References: <19990531234446.A64999@oitunix.oit.umass.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.5i In-Reply-To: <19990531234446.A64999@oitunix.oit.umass.edu>; from "Greg Pavelcak" on Mon May 31 23:44:46 GMT 1999 X-OS: FreeBSD 4.0-CURRENT Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In the last episode (May 31), Greg Pavelcak said: > Starting with a file containing a list of names: > > firstname1 lastname1 > firstname2 lastname2 > . > I wanted to do "whois" on all of them. My idea was: > > for i in `cat file`; do whois $i >> newfile ; done > > But the output of that appears to be what would be generated by: > > whois firstname1 > whois lastname1 > whois firstname2 cat file | while read i ; do whois $i ; done Alternatively, you could probably play with IFS to make the `` only split on newline, but I dislike that approach. -Dan Nelson dnelson@emsphone.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message