<?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 difficulties in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692971#M659014</link>
    <description>while read a&lt;BR /&gt;do&lt;BR /&gt;set -- $a&lt;BR /&gt;shift 6&lt;BR /&gt;echo $*&lt;BR /&gt;done</description>
    <pubDate>Wed, 29 Sep 2010 17:27:00 GMT</pubDate>
    <dc:creator>Laurent Menase</dc:creator>
    <dc:date>2010-09-29T17:27:00Z</dc:date>
    <item>
      <title>AWK difficulties</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692965#M659008</link>
      <description>On a string, how do I extract the string at field $9 to the end of the line.&lt;BR /&gt;&lt;BR /&gt;It's the "end of the line" I do not understand</description>
      <pubDate>Wed, 29 Sep 2010 13:44:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692965#M659008</guid>
      <dc:creator>ROSS HANSON</dc:creator>
      <dc:date>2010-09-29T13:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: AWK difficulties</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692966#M659009</link>
      <description>Hi Ross:&lt;BR /&gt;&lt;BR /&gt;# X="a b c d e f g h i j k"&lt;BR /&gt;&lt;BR /&gt;# echo $X|awk '{for (i=9;i&lt;NF&gt;&lt;/NF&gt;i j&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Wed, 29 Sep 2010 13:55:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692966#M659009</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-09-29T13:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: AWK difficulties</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692967#M659010</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;Sorry, the last post has a fence-post error.  The code should have been:&lt;BR /&gt;&lt;BR /&gt;# echo $X|awk '{for (i=9;i&amp;lt;=NF;i++) {printf "%s ",$i};printf "\n"&lt;BR /&gt;i j k&lt;BR /&gt;&lt;BR /&gt;Now, this said, if you wanted to preserve the exact whitespace spaceing between fields you could use:&lt;BR /&gt;&lt;BR /&gt;# awk '{print substr($0,index($0,$9))}' myfile&lt;BR /&gt;&lt;BR /&gt;...as for example&lt;BR /&gt;&lt;BR /&gt;# cat myfile&lt;BR /&gt;a b c d e f g h i j k&lt;BR /&gt;a b c d e f g h i j                 k&lt;BR /&gt;&lt;BR /&gt;awk '{print substr($0,index($0,$9))}' myfile&lt;BR /&gt;i j k&lt;BR /&gt;i j                 k&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 29 Sep 2010 14:14:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692967#M659010</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-09-29T14:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: AWK difficulties</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692968#M659011</link>
      <description>which part tells me from "i" to the end of the line?</description>
      <pubDate>Wed, 29 Sep 2010 14:20:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692968#M659011</guid>
      <dc:creator>ROSS HANSON</dc:creator>
      <dc:date>2010-09-29T14:20:50Z</dc:date>
    </item>
    <item>
      <title>Re: AWK difficulties</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692969#M659012</link>
      <description>&amp;gt;&amp;gt;&amp;gt; which part tells me from "i" to the end of the line?&lt;BR /&gt;&lt;BR /&gt;In the first method JRF shows that would be : i=9;i&amp;lt;=NF;i++&lt;BR /&gt;&lt;BR /&gt;The NF is the Number-of-Field = "the end"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;In the second method JRF proposes to just look for the byte offset where field 9 starts, and use that as the start of a string to extract. I like that, notably to preserve spacing. &lt;BR /&gt;But be careful that field 9 is indeed unique.&lt;BR /&gt;I typically 'help' that by adding separators (spaces) around the target string.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;$ X="a b c d e if g h i j k l m"&lt;BR /&gt;$  echo $X| awk '{print substr($0,index($0,$9))}'&lt;BR /&gt;if g h i j k l m&lt;BR /&gt;$  echo $X| awk '{print substr($0,index($0," " $9 " ") + 1)}'&lt;BR /&gt;i j k l m&lt;BR /&gt;&lt;BR /&gt;Obligatory PERL variant....&lt;BR /&gt;&lt;BR /&gt;$  echo $X| perl -lane 'print join " ",@F[8..@F]'&lt;BR /&gt;i j k l m&lt;BR /&gt;&lt;BR /&gt;Print the join of a slice of the array @F, set up by -a, using a space to join.&lt;BR /&gt;&lt;BR /&gt;The slice starts at element 8 ( Perl arrays are 0 based).&lt;BR /&gt;It ends at the scalar value for @F which is the number of elements in @F (but in a pinch 999 will work fine as well)&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 29 Sep 2010 14:53:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692969#M659012</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2010-09-29T14:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: AWK difficulties</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692970#M659013</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;Your profile shows that you have assigned points to 60 of 436 responses to your questions.  When you are satisfied with the help you have received, please assign points as a way of saying "thanks" and as a breadcrumb for future trollers:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/pageList.do?userId=CA238734&amp;amp;listType=unassigned&amp;amp;forumId=1" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/pageList.do?userId=CA238734&amp;amp;listType=unassigned&amp;amp;forumId=1&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 29 Sep 2010 17:14:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692970#M659013</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-09-29T17:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: AWK difficulties</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692971#M659014</link>
      <description>while read a&lt;BR /&gt;do&lt;BR /&gt;set -- $a&lt;BR /&gt;shift 6&lt;BR /&gt;echo $*&lt;BR /&gt;done</description>
      <pubDate>Wed, 29 Sep 2010 17:27:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692971#M659014</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2010-09-29T17:27:00Z</dc:date>
    </item>
    <item>
      <title>Re: AWK difficulties</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692972#M659015</link>
      <description>Ross, thanks for the feedback.&lt;BR /&gt;&lt;BR /&gt;It suggest that we interpreted the question(s) different from the way you intended them.&lt;BR /&gt;&lt;BR /&gt;Can you perhaps provide concrete input and output examples and show what you tried so far?&lt;BR /&gt;&lt;BR /&gt;Can you humor me and explain why you believe that JRF did not really answer the question asked with the limit information available in the question?&lt;BR /&gt;&lt;BR /&gt;Ditto for my further explanation? &lt;BR /&gt;I don't need no points, but would like to understand the large disconnect.&lt;BR /&gt;&lt;BR /&gt;Personally I thought Laurent's suggestion was great although admittedly it is not awk as per subject line.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 29 Sep 2010 20:20:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692972#M659015</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2010-09-29T20:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: AWK difficulties</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692973#M659016</link>
      <description>I mean "shift 8" not 6 to get $9 to end of line&lt;BR /&gt;&lt;BR /&gt;else &lt;BR /&gt;&lt;BR /&gt; cut -d " " -f 9-&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;to the "end of the line" means usually  for instance:&lt;BR /&gt;if the line is &lt;BR /&gt;1 2 3 4 5 6 7 8 9 10 11 12 &lt;BR /&gt;$1 is 1&lt;BR /&gt;$2 is 2&lt;BR /&gt;....&lt;BR /&gt;$9 is 9&lt;BR /&gt;$9 to the end of the line is&lt;BR /&gt;9 10 11 12&lt;BR /&gt;</description>
      <pubDate>Wed, 29 Sep 2010 20:36:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692973#M659016</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2010-09-29T20:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: AWK difficulties</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692974#M659017</link>
      <description>I am just trying to compare two systems. So, I thought by using the awk command to extract only the fields that I wanted would be better than the cut command</description>
      <pubDate>Wed, 29 Sep 2010 20:40:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692974#M659017</guid>
      <dc:creator>ROSS HANSON</dc:creator>
      <dc:date>2010-09-29T20:40:23Z</dc:date>
    </item>
    <item>
      <title>Re: AWK difficulties</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692975#M659018</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; So, I thought by using the awk command to extract only the fields that I wanted would be better than the cut command&lt;BR /&gt;&lt;BR /&gt;If all you are doing is comparing a string of fields, either 'awk' or 'cut' will work as we have described.  AWK becomes very powerful when you want to match *and* extract (among other things).  &lt;BR /&gt;&lt;BR /&gt;As we say in the Perl community, TMTOWTDI :-)&lt;BR /&gt;&lt;BR /&gt;As for points, thanks.  Remember, every response is available for your evaluation and there is no limit to how many total points you can assign in any one thread.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums11.itrc.hp.com/service/forums/helptips.do?#34" target="_blank"&gt;http://forums11.itrc.hp.com/service/forums/helptips.do?#34&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 29 Sep 2010 20:58:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692975#M659018</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-09-29T20:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: AWK difficulties</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692976#M659019</link>
      <description>&amp;gt;I thought by using the awk command to extract only the fields that I wanted would be better than the cut command&lt;BR /&gt;&lt;BR /&gt;Yes, awk(1) is much better than the cut(1) command in extracting fields, especially if you have a variable number of spaces/tabs between fields because of this:&lt;BR /&gt;Adjacent field delimiters delimit null fields.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Hein: But be careful that field 9 is indeed unique.  I typically 'help' that by adding separators (spaces) around the target string.&lt;BR /&gt;&lt;BR /&gt;That won't help if you have duplicate fields.  You may have to scan each field to see if it matches, then use index() that many times.</description>
      <pubDate>Thu, 30 Sep 2010 05:42:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-difficulties/m-p/4692976#M659019</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-09-30T05:42:34Z</dc:date>
    </item>
  </channel>
</rss>

