I would probably say less awkward in awk, since awk reads each line in a file automatically where in a shell script you must read each line individually in a loop. Much depends what you are going to do with the contents of the file and the command line arguments. AWK does not naturally handle command line arguments where shell does. But AWK handles individual records more elegantly, and provides you with the number of fields in each record and the record number of the line you are reading. A shell script that uses both sed and awk can do some very powerful things (as can perl, tcl and python). On 9 May 2002 at 11:18, Christopher Mahmood wrote:
* Mark Hounschell (markh@compro.net) [020509 09:06]:
How can you use the contents of a file as command line parameters for a script? The file has 3 colums and each colume I want to be command line $1 $2 $3 respectivly for the script.
$script < file does not seem to work
while read rec do your_command_here $rec done < file_with_args
You can also do this in awk but it's a little more, uhm..., awkward.
--
-ckm
-- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com
-- Jerry Feldman Portfolio Partner Engineering 508-467-4315 http://www.testdrive.compaq.com/linux/ Hewlett-Packard Company 200 Forest Street MRO1-3/F1 Marlboro, Ma. 01752