On 6/21/07, Jeffrey McCright <jmccright@hotmail.com> 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 MAC variable 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?