On 6/21/07, <b class="gmail_sendername">Jeffrey McCright</b> &lt;<a href="mailto:jmccright@hotmail.com">jmccright@hotmail.com</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
All,<br><br>I have a friend who needs to run a shell script to process data in a space<br>or comma delimited file. I think SED or AWK may be needed here, but I don&#39;t<br>program so I need help. The ASCII File structure is similar to the
<br>following:<br><br>Lastname Firstname internalphonenumber externalphonenumber phoneextention<br>MACaddress ...</blockquote><div><br></div><div><br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
{command} Lastname {command} Firstname {command} internalphonenumber<br>{command} externalphonenumber ...</blockquote><div><br><br>It&#39;s not clear whether you want to produce a new file interpolating some command(s) with these values or what, exactly
<br>
<br>
<span style="font-family: courier new,monospace; font-weight: bold;">cat <span style="font-style: italic;">asciifile</span> | while read LName FName IntPhn ExtPhn PhExt MAC Junk</span><br style="font-family: courier new,monospace; font-weight: bold;">
<span style="font-family: courier new,monospace; font-weight: bold;">
&nbsp;do</span><br style="font-family: courier new,monospace; font-weight: bold;"><span style="font-family: courier new,monospace; font-weight: bold;">
&nbsp; echo &quot;{command} $LName {command} $FName {command} $IntPhn {command} $ExtPhn {command} $PhExt {command} $MAC&quot;<br>done &gt;<span style="font-style: italic;">outputfile</span><br><br></span>You may find the <span style="font-family: courier new,monospace; font-weight: bold;">
read</span> metaphor easier than<span style="font-weight: bold;"> </span><span style="font-family: courier new,monospace; font-weight: bold;">awk</span><span style="font-weight: bold;"> </span>for this, because it&#39;s such a PITA to get the extra quoted spaces in there.&nbsp; You especially may find this works better if instead of just producing this output, you&#39;re actually needing to 
<span style="text-decoration: underline;">run</span> some command(s)<span style="font-family: courier new,monospace; font-weight: bold;"><br></span>inside the while loop. <br><br>Note the <span style="font-family: courier new,monospace; font-weight: bold;">
Junk</span> at the end of the <span style="font-family: courier new,monospace; font-weight: bold;">read</span> statement.&nbsp; It slurps up any extra words on the input line past the last variable name.&nbsp; That way the <span style="font-weight: bold; font-family: courier new,monospace;">
MAC</span> variable doesn&#39;t get junk in it.<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">etc...<br><br>The file contains around 1400 records or more. Each record needs to be
<br>processed as above.<br><br>Does this make sense? Any ideas?<br></blockquote></div><br>