<?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 print question in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-print-question/m-p/2617948#M925299</link>
    <description>James,&lt;BR /&gt;&lt;BR /&gt;Try this way.&lt;BR /&gt;&lt;BR /&gt;If your file is called my_text and the first four fields are fixed (say by "space") then you would do like this&lt;BR /&gt;&lt;BR /&gt;awk '{print  substr($0, index($0,$4))  }' my_text&lt;BR /&gt;&lt;BR /&gt;-Sri&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 20 Nov 2001 22:42:49 GMT</pubDate>
    <dc:creator>Sridhar Bhaskarla</dc:creator>
    <dc:date>2001-11-20T22:42:49Z</dc:date>
    <item>
      <title>Awk print question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-print-question/m-p/2617945#M925296</link>
      <description>I have a file that the first 4 fields are variable length and each only have 1 data item/word &lt;BR /&gt;FileName Tape#REC#  RptName Date and the last field is comments  variable length with words.  The file is not delimited.  I know how to use the printf sequence in awk to format the output for it to look nice, but the last field is comments and could be any number of words or stuff.  Is there a way in awk to say use $5, etc ...  till the end of the record and print it as one field.&lt;BR /&gt;</description>
      <pubDate>Tue, 20 Nov 2001 22:00:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-print-question/m-p/2617945#M925296</guid>
      <dc:creator>Belinda Dermody</dc:creator>
      <dc:date>2001-11-20T22:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: Awk print question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-print-question/m-p/2617946#M925297</link>
      <description>This may not be exactly what you are looking for but I think it will work. The output will need a little work.&lt;BR /&gt;&lt;BR /&gt;awk '{for (i = NF; i &amp;gt; 4; i--) print $i}'&lt;BR /&gt;&lt;BR /&gt;Good Luck,&lt;BR /&gt;C</description>
      <pubDate>Tue, 20 Nov 2001 22:25:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-print-question/m-p/2617946#M925297</guid>
      <dc:creator>Craig Rants</dc:creator>
      <dc:date>2001-11-20T22:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: Awk print question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-print-question/m-p/2617947#M925298</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;This "one-liner" awk program should do the trick for you:&lt;BR /&gt;&lt;BR /&gt;awk '{ rest=""; for (ix = 5; ix &amp;lt;= NF; ix++) { rest = rest " " $ix } printf("%-10.10s %-10.10s %-10.10s %-10.10s %s\n",$1,$2,$3,$4,rest) }' &lt;YOUR_FILE&gt;&lt;/YOUR_FILE&gt;&lt;BR /&gt;You may change the %-10.10s format to something that gives you a better aesthetic result.&lt;BR /&gt;&lt;BR /&gt;Hope it helps,&lt;BR /&gt;Paga&lt;BR /&gt;</description>
      <pubDate>Tue, 20 Nov 2001 22:38:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-print-question/m-p/2617947#M925298</guid>
      <dc:creator>Marco Paganini</dc:creator>
      <dc:date>2001-11-20T22:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: Awk print question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-print-question/m-p/2617948#M925299</link>
      <description>James,&lt;BR /&gt;&lt;BR /&gt;Try this way.&lt;BR /&gt;&lt;BR /&gt;If your file is called my_text and the first four fields are fixed (say by "space") then you would do like this&lt;BR /&gt;&lt;BR /&gt;awk '{print  substr($0, index($0,$4))  }' my_text&lt;BR /&gt;&lt;BR /&gt;-Sri&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 20 Nov 2001 22:42:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-print-question/m-p/2617948#M925299</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2001-11-20T22:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: Awk print question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-print-question/m-p/2617949#M925300</link>
      <description>Hi (again),&lt;BR /&gt;&lt;BR /&gt;A small correction. Make it $5 in the above awk statement otherwise it will print $4 + the comments.&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Tue, 20 Nov 2001 23:05:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-print-question/m-p/2617949#M925300</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2001-11-20T23:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: Awk print question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-print-question/m-p/2617950#M925301</link>
      <description>Thanks for the response, Craigs and Sridhar did not work or provide the output that I was looking for, Marco works great, a long one liner though and I have to change the formating parameters.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Wed, 21 Nov 2001 16:41:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-print-question/m-p/2617950#M925301</guid>
      <dc:creator>Belinda Dermody</dc:creator>
      <dc:date>2001-11-21T16:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: Awk print question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-print-question/m-p/2617951#M925302</link>
      <description>James,&lt;BR /&gt;&lt;BR /&gt;Probably it would have helped if you provided a sample input file.&lt;BR /&gt;&lt;BR /&gt;If your input file is like this&lt;BR /&gt;&lt;BR /&gt;testfile 23#1212 test.report 11/12/01 this is ofcourse       my comment&lt;BR /&gt;&lt;BR /&gt;Then &lt;BR /&gt;&lt;BR /&gt;awk '{print  substr($0, index($0,$5))  }' input_file&lt;BR /&gt;&lt;BR /&gt;will print out &lt;BR /&gt;&lt;BR /&gt;this is ofcourse        my comment&lt;BR /&gt;&lt;BR /&gt;It's a very simple logic that we are printing the substring starting from $5 (this) no matter what spaces or characters are there later. You don't have to deal with the formatting.&lt;BR /&gt;&lt;BR /&gt;-Sri&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;</description>
      <pubDate>Wed, 21 Nov 2001 16:52:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-print-question/m-p/2617951#M925302</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2001-11-21T16:52:48Z</dc:date>
    </item>
  </channel>
</rss>

