Hello Ann:<br><br>man (g)awk&nbsp;&nbsp; <br><br>:-)<br><br>awk -v | --assign&nbsp; &lt;internal variable name&gt;=&lt;variable value&gt; &lt;other awk options and stuff&gt;<br><br><br>Not quite sure what you want to do do.&nbsp; Can you show the resulting output or be a bit more specific.
<br><br><br>Regards,<br>Lou<br><div class="gmail_quote">On Nov 22, 2007 12:55 PM, ann kok &lt;<a href="mailto:annkok2001@yahoo.com">annkok2001@yahoo.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Lou<br><br>Thank you very much<br><br>One more question. how can I put the CGA number as<br>variable?<br><br>eg: CGA001, CGA002..... when<br>i run the program<br><br>awk -v CGA=`for loop` program.awk file.txt<br><br>or any way to do it?
<br><div class="Ih2E3d"><br>Thank you again<br><br><br><br>BEGIN { RS = &quot;\n&quot; ; FS = &quot;|&quot; }<br>{<br></div>print &quot;File No.: CGA001<br><div><div></div><div class="Wj3C7c">print &quot;&quot;<br>}<br><br>
<br>--- Lou Spironello &lt;<a href="mailto:lspironello@gmail.com">lspironello@gmail.com</a>&gt; wrote:<br><br>&gt; awk -v HST=`hostname` -f program.awk file.txt<br>&gt;<br>&gt; inside program.awk<br>&gt; use:<br>&gt;<br>&gt; &nbsp; printf &quot;from: %s\n&quot;,HST
<br>&gt;<br>&gt; Regards,<br>&gt; Lou<br>&gt;<br>&gt; On Nov 21, 2007 3:41 PM, ann kok<br>&gt; &lt;<a href="mailto:annkok2001@yahoo.com">annkok2001@yahoo.com</a>&gt; wrote:<br>&gt;<br>&gt; &gt; Thank you<br>&gt; &gt;<br>&gt; &gt; but i don&#39;t know how to put the hostname in awk
<br>&gt; &gt; program<br>&gt; &gt;<br>&gt; &gt; eg: my program is &quot;program.awk<br>&gt; &gt;<br>&gt; &gt; awk -f program.awk file.txt<br>&gt; &gt;<br>&gt; &gt; Thank you again<br>&gt; &gt;<br>&gt; &gt; BEGIN { RS = &quot;\n&quot; ; FS = &quot;|&quot; }
<br>&gt; &gt;<br>&gt; &gt; &nbsp;{<br>&gt; &gt; print &quot;Name:&quot;, $9<br>&gt; &gt; print &quot;Created: `date`&quot;<br>&gt; &gt; print &quot;from: `hostname`&quot;<br>&gt; &gt; print &quot;&quot;<br>&gt; &gt; }<br>&gt; &gt;
<br>&gt; &gt;<br>&gt; &gt; --- Lou Spironello &lt;<a href="mailto:lspironello@gmail.com">lspironello@gmail.com</a>&gt; wrote:<br>&gt; &gt;<br>&gt; &gt; &gt; Hope this helps.<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; echo &quot;test&quot; | awk -v mydate=`date +%Y%m%d`
<br>&gt; &#39;{printf<br>&gt; &gt; &gt; &quot;standard input is<br>&gt; &gt; &gt; %s\nmy variable value is %s\n&quot;,$1,mydate}&#39;<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; :-)<br>&gt; &gt; &gt;<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; Regards,
<br>&gt; &gt; &gt; Lou<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; On Nov 21, 2007 12:22 PM, ann kok<br>&gt; &gt; &gt; &lt;<a href="mailto:annkok2001@yahoo.com">annkok2001@yahoo.com</a>&gt; wrote:<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; Hi all
<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; how can I print date in this date format?<br>&gt; 20071122<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; Can command &quot;date, hostname&quot; run in awk<br>&gt; program<br>
&gt; &gt; &gt; &gt; itself?<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; program.awk<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; &nbsp; &nbsp; BEGIN { RS = &quot;\n&quot; ; FS = &quot;|&quot; }<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; &nbsp; &nbsp; {
<br>&gt; &gt; &gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print &quot;Name:&quot;, $9<br>&gt; &gt; &gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print &quot;Created: `date`&quot;<br>&gt; &gt; &gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print &quot;from: `hostname`&quot;<br>&gt; &gt; &gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print &quot;&quot;
<br>&gt; &gt; &gt; &gt; &nbsp; &nbsp; }<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; Thank you<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt;<br>&gt; &gt;<br>&gt; &gt;
<br>&gt;<br>____________________________________________________________________________________<br>&gt; &gt; &gt; &gt; Be a better pen pal.<br>&gt; &gt; &gt; &gt; Text or chat with friends inside Yahoo! Mail.<br>&gt; See
<br>&gt; &gt; &gt; how.<br>&gt; &gt; &gt; &gt; <a href="http://overview.mail.yahoo.com/" target="_blank">http://overview.mail.yahoo.com/</a><br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; --<br>&gt; &gt; &gt; &gt; fedora-list mailing list
<br>&gt; &gt; &gt; &gt; <a href="mailto:fedora-list@redhat.com">fedora-list@redhat.com</a><br>&gt; &gt; &gt; &gt; To unsubscribe:<br>&gt; &gt; &gt;<br>&gt; <a href="https://www.redhat.com/mailman/listinfo/fedora-list" target="_blank">
https://www.redhat.com/mailman/listinfo/fedora-list</a><br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; --<br>&gt; &gt; &gt; fedora-list mailing list<br>&gt; &gt; &gt; <a href="mailto:fedora-list@redhat.com">fedora-list@redhat.com
</a><br>&gt; &gt; &gt; To unsubscribe:<br>&gt; &gt;<br>&gt; <a href="https://www.redhat.com/mailman/listinfo/fedora-list" target="_blank">https://www.redhat.com/mailman/listinfo/fedora-list</a><br>&gt; &gt;<br>&gt; &gt;<br>
&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt;<br>____________________________________________________________________________________<br>&gt; &gt; Get easy, one-click access to your favorites.<br>&gt; &gt; Make Yahoo! your homepage.
<br>&gt; &gt; <a href="http://www.yahoo.com/r/hs" target="_blank">http://www.yahoo.com/r/hs</a><br>&gt; &gt;<br>&gt; &gt; --<br>&gt; &gt; fedora-list mailing list<br>&gt; &gt; <a href="mailto:fedora-list@redhat.com">fedora-list@redhat.com
</a><br>&gt; &gt; To unsubscribe:<br>&gt; <a href="https://www.redhat.com/mailman/listinfo/fedora-list" target="_blank">https://www.redhat.com/mailman/listinfo/fedora-list</a><br>&gt; &gt;<br></div></div>&gt; &gt; --<br><div class="Ih2E3d">
&gt; fedora-list mailing list<br>&gt; <a href="mailto:fedora-list@redhat.com">fedora-list@redhat.com</a><br>&gt; To unsubscribe:<br><a href="https://www.redhat.com/mailman/listinfo/fedora-list" target="_blank">https://www.redhat.com/mailman/listinfo/fedora-list
</a><br><br><br><br></div> &nbsp; &nbsp; &nbsp;____________________________________________________________________________________<br><div><div></div><div class="Wj3C7c">Be a better pen pal.<br>Text or chat with friends inside Yahoo! Mail. See how. &nbsp;
<a href="http://overview.mail.yahoo.com/" target="_blank">http://overview.mail.yahoo.com/</a><br><br>--<br>fedora-list mailing list<br><a href="mailto:fedora-list@redhat.com">fedora-list@redhat.com</a><br>To unsubscribe: 
<a href="https://www.redhat.com/mailman/listinfo/fedora-list" target="_blank">https://www.redhat.com/mailman/listinfo/fedora-list</a><br></div></div></blockquote></div><br>