<?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: Stuck on Awk Statement in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/stuck-on-awk-statement/m-p/4509827#M681202</link>
    <description>Hi,&lt;BR /&gt;&amp;gt;&amp;gt;did I explain that correctly.&lt;BR /&gt;&lt;BR /&gt;Yes you did, in awk $1 means 1st filed $2 means 2nd field and so on &lt;BR /&gt;and $0 is for hole line&lt;BR /&gt;in your awk you can do is like this way also&lt;BR /&gt;$ awk -F "-" '{ print $1" " $2" " $3}'&lt;INPUTFILE&gt;&lt;/INPUTFILE&gt;no need to give cat filename&lt;BR /&gt;&lt;BR /&gt;to know more about awk see the below link&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.ibm.com/developerworks/library/l-awk1.html" target="_blank"&gt;http://www.ibm.com/developerworks/library/l-awk1.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.ibm.com/developerworks/library/l-awk2.html" target="_blank"&gt;http://www.ibm.com/developerworks/library/l-awk2.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.grymoire.com/Unix/Awk.html" target="_blank"&gt;http://www.grymoire.com/Unix/Awk.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Suraj</description>
    <pubDate>Thu, 08 Oct 2009 00:56:59 GMT</pubDate>
    <dc:creator>Suraj K Sankari</dc:creator>
    <dc:date>2009-10-08T00:56:59Z</dc:date>
    <item>
      <title>Stuck on Awk Statement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/stuck-on-awk-statement/m-p/4509824#M681199</link>
      <description>I really have tried to figure this out on my own and I hate having to ask but I am stuck here. I read it but don't understand the option.&lt;BR /&gt;&lt;BR /&gt;I have an input file that looks like:&lt;BR /&gt;1234-1234-123-12-1234-11234-123&lt;BR /&gt;&lt;BR /&gt;I am using the "-" as my field separator. I can get the first 3 fields using something like, cat myfile | awk -F- '{ print $1 $2 $3 }'&lt;BR /&gt;&lt;BR /&gt;But I want to treat the 4th,5th,6th and 7th field as one field.&lt;BR /&gt;so I would end up with four fields.&lt;BR /&gt;$1 $2 $3 [$4 $5 $6 &amp;amp;7]&lt;BR /&gt;&lt;BR /&gt;did I explain that correctly.&lt;BR /&gt;well anyway, I cant figure it out and I really did give it a go. any help appreciated&lt;BR /&gt;&lt;BR /&gt;thanks</description>
      <pubDate>Wed, 07 Oct 2009 18:17:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/stuck-on-awk-statement/m-p/4509824#M681199</guid>
      <dc:creator>Nobody's Hero</dc:creator>
      <dc:date>2009-10-07T18:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: Stuck on Awk Statement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/stuck-on-awk-statement/m-p/4509825#M681200</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;# X="1234-1234-123-12-1234-11234-123"&lt;BR /&gt;&lt;BR /&gt;# echo $X | awk -F"-" '{$4=$4"-"$5"-"$6"-"$7;print $1,$2,$3,$4}'&lt;BR /&gt;1234 1234 123 12-1234-11234-123&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 07 Oct 2009 18:25:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/stuck-on-awk-statement/m-p/4509825#M681200</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-10-07T18:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: Stuck on Awk Statement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/stuck-on-awk-statement/m-p/4509826#M681201</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;Cool part here is the delimiter.&lt;BR /&gt;&lt;BR /&gt;-F"-" &lt;BR /&gt;&lt;BR /&gt;Want to look at a passwd file, use :&lt;BR /&gt;&lt;BR /&gt;Almost any delimiter can be used. The default for awk is spaces.&lt;BR /&gt;&lt;BR /&gt;awk is a good friend of the sysadmin. Great power.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Wed, 07 Oct 2009 19:41:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/stuck-on-awk-statement/m-p/4509826#M681201</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2009-10-07T19:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: Stuck on Awk Statement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/stuck-on-awk-statement/m-p/4509827#M681202</link>
      <description>Hi,&lt;BR /&gt;&amp;gt;&amp;gt;did I explain that correctly.&lt;BR /&gt;&lt;BR /&gt;Yes you did, in awk $1 means 1st filed $2 means 2nd field and so on &lt;BR /&gt;and $0 is for hole line&lt;BR /&gt;in your awk you can do is like this way also&lt;BR /&gt;$ awk -F "-" '{ print $1" " $2" " $3}'&lt;INPUTFILE&gt;&lt;/INPUTFILE&gt;no need to give cat filename&lt;BR /&gt;&lt;BR /&gt;to know more about awk see the below link&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.ibm.com/developerworks/library/l-awk1.html" target="_blank"&gt;http://www.ibm.com/developerworks/library/l-awk1.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.ibm.com/developerworks/library/l-awk2.html" target="_blank"&gt;http://www.ibm.com/developerworks/library/l-awk2.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.grymoire.com/Unix/Awk.html" target="_blank"&gt;http://www.grymoire.com/Unix/Awk.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Suraj</description>
      <pubDate>Thu, 08 Oct 2009 00:56:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/stuck-on-awk-statement/m-p/4509827#M681202</guid>
      <dc:creator>Suraj K Sankari</dc:creator>
      <dc:date>2009-10-08T00:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Stuck on Awk Statement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/stuck-on-awk-statement/m-p/4509828#M681203</link>
      <description>&lt;!--!*#--&gt;Perl is an even better friend of the sysadmin:&lt;BR /&gt;&lt;BR /&gt;$ echo "1234-1234-123-12-1234-11234-123" | \&lt;BR /&gt;  perl -ne \&lt;BR /&gt;    'print join(" ", split(/-/, $_, 4));'&lt;BR /&gt;1234 1234 123 12-1234-11234-123&lt;BR /&gt;$&lt;BR /&gt;&lt;BR /&gt;This can handle an arbitrary number of fields - the "4" as the last argument of split designates the total number of split fields, encompassing the entire remainder of the line in the fourth.&lt;BR /&gt;&lt;BR /&gt;Awk was first written in 1977, and needless to say its capabilities and idiosyncrasies such as the $1 $2 .. $n notation, among many other useful sysadmin tools, inspired Larry Wall's original architecture of Perl in 1987.</description>
      <pubDate>Thu, 08 Oct 2009 12:10:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/stuck-on-awk-statement/m-p/4509828#M681203</guid>
      <dc:creator>mvpel</dc:creator>
      <dc:date>2009-10-08T12:10:35Z</dc:date>
    </item>
  </channel>
</rss>

