<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Awk Question in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/3074022#M141328</link>
    <description>Hi Leif,&lt;BR /&gt;&lt;BR /&gt;consider multiple spaces and TABs seperating fields, or white space at the beginning or at the end of a line ... . 'tr' won't do it, then.&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
    <pubDate>Fri, 19 Sep 2003 13:54:50 GMT</pubDate>
    <dc:creator>Peter Nikitka</dc:creator>
    <dc:date>2003-09-19T13:54:50Z</dc:date>
    <item>
      <title>Awk Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/3074016#M141322</link>
      <description>Hi,&lt;BR /&gt;I have make a script where I want print all fields separate from a , .&lt;BR /&gt;I don't know hoe mach fields there are.&lt;BR /&gt;This is a script&lt;BR /&gt;&lt;BR /&gt;cat try.out |while read line&lt;BR /&gt;do&lt;BR /&gt;line1=`echo $linea |awk 'BEGIN {OFS=","}&lt;BR /&gt;{for(i=1;i&amp;lt;=NF;i++)print $i}'`&lt;BR /&gt;echo $line1&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;but when I see the output I don't see , between the fields.&lt;BR /&gt;&lt;BR /&gt;Please help&lt;BR /&gt;&lt;BR /&gt;Filo</description>
      <pubDate>Thu, 18 Sep 2003 10:28:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/3074016#M141322</guid>
      <dc:creator>Filosofo</dc:creator>
      <dc:date>2003-09-18T10:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/3074017#M141323</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;It would be simpler to use "printf" which prints formatted text as in&lt;BR /&gt;&lt;BR /&gt;printf "%s,",$i &lt;BR /&gt;&lt;BR /&gt;which will print $i followed by a comma</description>
      <pubDate>Thu, 18 Sep 2003 10:49:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/3074017#M141323</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-09-18T10:49:53Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/3074018#M141324</link>
      <description>or simply : print $i,","&lt;BR /&gt;Rgds,&lt;BR /&gt;JL</description>
      <pubDate>Thu, 18 Sep 2003 10:53:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/3074018#M141324</guid>
      <dc:creator>Jean-Luc Oudart</dc:creator>
      <dc:date>2003-09-18T10:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/3074019#M141325</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;dont't know exactly what you need, but look at this:&lt;BR /&gt;echo 'a b c\nd\te   f' |&lt;BR /&gt;awk -v ORS=, '{for(i=1;i&lt;NF&gt;&lt;/NF&gt;printf($NF"\n")}'&lt;BR /&gt;&lt;BR /&gt;gives the following output:&lt;BR /&gt;a,b,c&lt;BR /&gt;d,e,f&lt;BR /&gt;&lt;BR /&gt;So try&lt;BR /&gt;awk -v ORS=, '{for(i=1;i&lt;NF&gt;&lt;/NF&gt;printf($NF"\n")}' try.out&lt;BR /&gt;&lt;BR /&gt;There is no need for cat and Shell-variables.&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Fri, 19 Sep 2003 12:25:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/3074019#M141325</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2003-09-19T12:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/3074020#M141326</link>
      <description>Hi,&lt;BR /&gt;If I undrrstend you correct the fields is separated with spaces and you want output separated with commas. Why not use tr.&lt;BR /&gt;Try:&lt;BR /&gt; echo "ddd GGG" |tr " " ","</description>
      <pubDate>Fri, 19 Sep 2003 13:15:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/3074020#M141326</guid>
      <dc:creator>Leif Halvarsson_2</dc:creator>
      <dc:date>2003-09-19T13:15:34Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/3074021#M141327</link>
      <description>Cleanest way is to create a file called try.awk:&lt;BR /&gt;&lt;BR /&gt;{for (idx=1;idx&lt;NF&gt;&lt;/NF&gt;    {printf("%s,",$idx)}&lt;BR /&gt; printf("%s\n",$NF);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Then run it in your script as:&lt;BR /&gt;&lt;BR /&gt;awk -f try.awk &amp;lt; try.out &amp;gt; outputfile&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Sep 2003 13:24:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/3074021#M141327</guid>
      <dc:creator>Kent Ostby</dc:creator>
      <dc:date>2003-09-19T13:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/3074022#M141328</link>
      <description>Hi Leif,&lt;BR /&gt;&lt;BR /&gt;consider multiple spaces and TABs seperating fields, or white space at the beginning or at the end of a line ... . 'tr' won't do it, then.&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Fri, 19 Sep 2003 13:54:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/3074022#M141328</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2003-09-19T13:54:50Z</dc:date>
    </item>
  </channel>
</rss>

