<?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/4133821#M316577</link>
    <description>Save yourself a ton of work and do a search in the Forums for a script of Bill Hassell's called "bdfmegs".</description>
    <pubDate>Wed, 23 Jan 2008 01:02:16 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2008-01-23T01:02:16Z</dc:date>
    <item>
      <title>awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/4133820#M316576</link>
      <description>&lt;BR /&gt;I am having the output of du -xk in a file and it's  showing up as this : &lt;BR /&gt;&lt;BR /&gt;grep M tmp_space|more&lt;BR /&gt;&lt;BR /&gt;1022M   /alerts&lt;BR /&gt;1015M   /heartbeat&lt;BR /&gt;987M    /home/allan&lt;BR /&gt;983M    /home/allan2&lt;BR /&gt;969M    /home/aint.....&lt;BR /&gt;932K    /home/aint4&lt;BR /&gt;&lt;BR /&gt;I need to go away with k's ( kilo bytes ) and show only M's ( megabytes ) along with the dir listing. How do I do that. Please help.</description>
      <pubDate>Wed, 23 Jan 2008 00:55:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/4133820#M316576</guid>
      <dc:creator>Allanm</dc:creator>
      <dc:date>2008-01-23T00:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/4133821#M316577</link>
      <description>Save yourself a ton of work and do a search in the Forums for a script of Bill Hassell's called "bdfmegs".</description>
      <pubDate>Wed, 23 Jan 2008 01:02:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/4133821#M316577</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2008-01-23T01:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/4133822#M316578</link>
      <description>&lt;BR /&gt;Hmmm,&lt;BR /&gt;&lt;BR /&gt;1) my "du -xk" does not output a K, nor an M&lt;BR /&gt;2) my grep for M does not return a line like "932K /home/aint4" without an M&lt;BR /&gt;3) do you want to just not just any line with K, or 'convert' to M? If converting, round? truncate or use decimals?&lt;BR /&gt;4) where is awk in this picture? &lt;BR /&gt;I suspect an awk script made the M/K output lines. Why not show (the critical parts) of it?&lt;BR /&gt;&lt;BR /&gt;Finally, my guess for a solution... just make that grep more precise.&lt;BR /&gt;What's the whitespace between M and / ?&lt;BR /&gt;Is it a TAB as per du, or spaces?&lt;BR /&gt;&lt;BR /&gt;for spaces try: &lt;BR /&gt;grep -E "M +\/"  tmp_space&lt;BR /&gt;&lt;BR /&gt;for tab try&lt;BR /&gt;grep -E "M[[:cntrl:]]\/" tmp_space&lt;BR /&gt;&lt;BR /&gt;in perl&lt;BR /&gt;&lt;BR /&gt;perl -ne 'print if /M\s+\//' tmp_space&lt;BR /&gt;or&lt;BR /&gt;perl -ne 'print if m:M\s+/:' tmp_space&lt;BR /&gt;&lt;BR /&gt;cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Wed, 23 Jan 2008 01:38:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/4133822#M316578</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-01-23T01:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/4133823#M316579</link>
      <description>&lt;!--!*#--&gt;If you just want to use awk to change the lines with "K" you can use:&lt;BR /&gt;awk '&lt;BR /&gt;{&lt;BR /&gt;len = length($1)&lt;BR /&gt;number = substr($1, 1, len - 1)&lt;BR /&gt;unit = substr($1, len, 1)&lt;BR /&gt;if (unit == "M")&lt;BR /&gt;   print $0&lt;BR /&gt;else # assume K&lt;BR /&gt;   printf "%.3fM %s\n", number/1024, $2&lt;BR /&gt;} ' tmp_space</description>
      <pubDate>Wed, 23 Jan 2008 07:45:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/4133823#M316579</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-01-23T07:45:47Z</dc:date>
    </item>
  </channel>
</rss>

