Thanks, Monty! I will pass it along.
Jeffrey A. McCright, A+ 816-210-3107 [email protected]
From: "Monty J. Harder" [email protected] To: "Jeffrey McCright" [email protected] CC: [email protected] Subject: Re: Need script help. Date: Thu, 21 Jun 2007 11:24:55 -0500
On 6/21/07, Jeffrey McCright [email protected] wrote:
All,
I have a friend who needs to run a shell script to process data in a space or comma delimited file. I think SED or AWK may be needed here, but I don't program so I need help. The ASCII File structure is similar to the following:
Lastname Firstname internalphonenumber externalphonenumber phoneextention MACaddress ...
{command} Lastname {command} Firstname {command} internalphonenumber
{command} externalphonenumber ...
It's not clear whether you want to produce a new file interpolating some command(s) with these values or what, exactly
cat asciifile | while read LName FName IntPhn ExtPhn PhExt MAC Junk do echo "{command} $LName {command} $FName {command} $IntPhn {command} $ExtPhn {command} $PhExt {command} $MAC" done >outputfile
You may find the read metaphor easier than awk for this, because it's such a PITA to get the extra quoted spaces in there. You especially may find this works better if instead of just producing this output, you're actually needing to run some command(s) inside the while loop.
Note the Junk at the end of the read statement. It slurps up any extra words on the input line past the last variable name. That way the MACvariable doesn't get junk in it.
etc...
The file contains around 1400 records or more. Each record needs to be processed as above.
Does this make sense? Any ideas?
_________________________________________________________________ Hotmail to go? Get your Hotmail, news, sports and much more! http://mobile.msn.com