<?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 remove lines format to columns in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-remove-lines-format-to-columns/m-p/5150372#M683620</link>
    <description>Works PERFECT!&lt;BR /&gt;I have been fiddling with printf and nothing but errors. &lt;BR /&gt;Put a question in and I got a reply with 10 minutes!</description>
    <pubDate>Tue, 13 Jan 2009 22:41:23 GMT</pubDate>
    <dc:creator>Ratzie</dc:creator>
    <dc:date>2009-01-13T22:41:23Z</dc:date>
    <item>
      <title>awk remove lines format to columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-remove-lines-format-to-columns/m-p/5150370#M683618</link>
      <description>I am trying to write a ksh script that pulls data to a file, have it working no problem.&lt;BR /&gt;format of file.&lt;BR /&gt;&lt;BR /&gt;13-JAN-09-22:17:00&lt;BR /&gt;12-JAN-09-07:13:07&lt;BR /&gt;NULL&lt;BR /&gt;NULL&lt;BR /&gt;13-JAN-09-21:08:04&lt;BR /&gt;&lt;BR /&gt;Some times the NULL values will also be dates.&lt;BR /&gt;&lt;BR /&gt;So I want to take this and join lines and format to columns.&lt;BR /&gt;&lt;BR /&gt;Here is what I have working:&lt;BR /&gt;cat test.1| tr '\n' '\t'|awk '{print $1, $2, $3, $4, $5}'&amp;gt;&amp;gt;monitor.log&lt;BR /&gt;&lt;BR /&gt;what I would like to do is have each variable line up at certain column.&lt;BR /&gt;&lt;BR /&gt;Because right now the file looks fine:&lt;BR /&gt;13-JAN-09-22:16:38 12-JAN-09-07:12:57 NULL NULL 13-JAN-09-21:08:04&lt;BR /&gt;13-JAN-09-22:17:00 12-JAN-09-07:13:07 NULL NULL 13-JAN-09-21:08:04&lt;BR /&gt;&lt;BR /&gt;But if I get an entry in $3 $4, nothing will line up anymore.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;So how do I format $1 to start at 1, $2 start at 15 $3 start at the next 15... on so on.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Jan 2009 22:24:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-remove-lines-format-to-columns/m-p/5150370#M683618</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2009-01-13T22:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: awk remove lines format to columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-remove-lines-format-to-columns/m-p/5150371#M683619</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; So how do I format $1 to start at 1, $2 start at 15 $3 start at the next 15... on so on.&lt;BR /&gt;&lt;BR /&gt;You use formatted print statements:&lt;BR /&gt;&lt;BR /&gt;# cat test.1|tr '\n' '\t'|awk '{printf "%-15s %-15s %-15s %-15s %-15s\n",$1,$2,$3,$4,$5}'&lt;BR /&gt;&lt;BR /&gt;This lef-justifies fields in units of 15-characters.  See the manpages for 'printf'.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Jan 2009 22:37:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-remove-lines-format-to-columns/m-p/5150371#M683619</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-01-13T22:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: awk remove lines format to columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-remove-lines-format-to-columns/m-p/5150372#M683620</link>
      <description>Works PERFECT!&lt;BR /&gt;I have been fiddling with printf and nothing but errors. &lt;BR /&gt;Put a question in and I got a reply with 10 minutes!</description>
      <pubDate>Tue, 13 Jan 2009 22:41:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-remove-lines-format-to-columns/m-p/5150372#M683620</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2009-01-13T22:41:23Z</dc:date>
    </item>
  </channel>
</rss>

