<?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: Extract fields from text file. in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/extract-fields-from-text-file/m-p/5043837#M95930</link>
    <description>Thanks James for your tips on effecting scripting.&lt;BR /&gt;It is good to avoid unnecessary extra command usage.&lt;BR /&gt;&lt;BR /&gt;Learning is never ending process! &lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Rajesh &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 02 May 2007 08:11:22 GMT</pubDate>
    <dc:creator>Rajesh SB</dc:creator>
    <dc:date>2007-05-02T08:11:22Z</dc:date>
    <item>
      <title>Extract fields from text file.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/extract-fields-from-text-file/m-p/5043828#M95921</link>
      <description>Hi Experts,&lt;BR /&gt;&lt;BR /&gt;I have df -k output text&lt;BR /&gt;Can any body help me in extracting last 2 column fields(Space Separator) from below text irrespective of no. of coloumns.&lt;BR /&gt;&lt;BR /&gt;mpfs                   38G     0K    38G     0%    /dev/vx/rdmp&lt;BR /&gt;swap                    38G   356M    38G     1%    /tmp&lt;BR /&gt;/dev/vx/dsk/bootdg/opt&lt;BR /&gt;                        32G    15G    17G    48%    /opt&lt;BR /&gt;/dev/vx/dsk/tempbackup_DG/tempvol&lt;BR /&gt;                       200G   8.6G   179G     5%    /tempbackup&lt;BR /&gt;/dev/vx/dsk/dbaarch_DG/dbaarch_data_Vol6&lt;BR /&gt;                        98G    28G    69G    29%    /opt/oraclea/arch&lt;BR /&gt;/dev/vx/dsk/dbabckp_DG/dbabckp_data_Vol5&lt;BR /&gt;                       100G    25G    75G    25%    /opt/oraclea/backup&lt;BR /&gt;/dev/vx/dsk/dba_DG/dba_data_Vol2&lt;BR /&gt;                        50G    48G   1.6G    97%    /opt/oraclea/mnt2&lt;BR /&gt;&lt;BR /&gt;Any tips.&lt;BR /&gt;&lt;BR /&gt;Thanks &amp;amp; Regards,&lt;BR /&gt;Rajesh SB</description>
      <pubDate>Wed, 02 May 2007 07:27:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/extract-fields-from-text-file/m-p/5043828#M95921</guid>
      <dc:creator>Rajesh SB</dc:creator>
      <dc:date>2007-05-02T07:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: Extract fields from text file.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/extract-fields-from-text-file/m-p/5043829#M95922</link>
      <description>Hi Rajesh SB,&lt;BR /&gt;try this &lt;BR /&gt;df -k &amp;gt; dfk.txt&lt;BR /&gt;awk â  Fâ   â   â  { print $5, $6 }â   dfk.txt&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;pg</description>
      <pubDate>Wed, 02 May 2007 07:30:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/extract-fields-from-text-file/m-p/5043829#M95922</guid>
      <dc:creator>Piergiacomo Perini</dc:creator>
      <dc:date>2007-05-02T07:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: Extract fields from text file.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/extract-fields-from-text-file/m-p/5043830#M95923</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;This seems to work overhere:&lt;BR /&gt;&lt;BR /&gt;# cat file.txt | awk '{FROM=(NF-2);print $FROM,$(FROM+1),$NF}'&lt;BR /&gt;&lt;BR /&gt;--&amp;gt; returns 3 last fields.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Wout</description>
      <pubDate>Wed, 02 May 2007 07:34:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/extract-fields-from-text-file/m-p/5043830#M95923</guid>
      <dc:creator>Wouter Jagers</dc:creator>
      <dc:date>2007-05-02T07:34:43Z</dc:date>
    </item>
    <item>
      <title>Re: Extract fields from text file.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/extract-fields-from-text-file/m-p/5043831#M95924</link>
      <description>Thanks PG for quick response.&lt;BR /&gt;&lt;BR /&gt;Some of the lines are having 6 columns and some are with 5 columns.&lt;BR /&gt;&lt;BR /&gt;I am particularly looking for mount-point and percentage columns.&lt;BR /&gt;&lt;BR /&gt;You command won't work.&lt;BR /&gt;Any other tips.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Rajesh</description>
      <pubDate>Wed, 02 May 2007 07:37:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/extract-fields-from-text-file/m-p/5043831#M95924</guid>
      <dc:creator>Rajesh SB</dc:creator>
      <dc:date>2007-05-02T07:37:30Z</dc:date>
    </item>
    <item>
      <title>Re: Extract fields from text file.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/extract-fields-from-text-file/m-p/5043832#M95925</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;# awk '{print $NF,$(NF-1)}' file&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 02 May 2007 07:40:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/extract-fields-from-text-file/m-p/5043832#M95925</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-05-02T07:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: Extract fields from text file.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/extract-fields-from-text-file/m-p/5043833#M95926</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I would add a check to send output only when there are more than 2 columns - this will deal correctly with the bdf output for long device names:&lt;BR /&gt;&lt;BR /&gt;bdf -l | awk 'NF&amp;gt;2 {print $(NF-1),$NF}'&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Wed, 02 May 2007 07:41:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/extract-fields-from-text-file/m-p/5043833#M95926</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2007-05-02T07:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: Extract fields from text file.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/extract-fields-from-text-file/m-p/5043834#M95927</link>
      <description>Thanks Peter,&lt;BR /&gt;You command is working fine.&lt;BR /&gt;Highly appreciate your timely response.&lt;BR /&gt;&lt;BR /&gt;Case-1 Not Worked &lt;BR /&gt;cat df-k.op| awk '{FROM=(NF-2);print $FROM,$(FROM+1),$NF}'&lt;BR /&gt;awk: The field -1 must be in the range 0 to 199.&lt;BR /&gt;&lt;BR /&gt; The input line number is 2.&lt;BR /&gt; The source line number is 1.&lt;BR /&gt;&lt;BR /&gt;Case-2 Not worked:&lt;BR /&gt;cat df-k.op|grep -v Filesystem| awk '{FROM=(NF-2);print $FROM,$(FROM+1),$NF}'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks to you all for quick response again&lt;BR /&gt;&lt;BR /&gt;Thanks &amp;amp; Regards,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 02 May 2007 07:52:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/extract-fields-from-text-file/m-p/5043834#M95927</guid>
      <dc:creator>Rajesh SB</dc:creator>
      <dc:date>2007-05-02T07:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: Extract fields from text file.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/extract-fields-from-text-file/m-p/5043835#M95928</link>
      <description>Hi (again) Rajesh:&lt;BR /&gt;&lt;BR /&gt;Avoid the extra 'cat' process just to read a file.  Instead of :&lt;BR /&gt;&lt;BR /&gt;# cat myfile | awk '...'&lt;BR /&gt;&lt;BR /&gt;...simply do:&lt;BR /&gt;&lt;BR /&gt;# awk '...' myfile&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 02 May 2007 07:56:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/extract-fields-from-text-file/m-p/5043835#M95928</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-05-02T07:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: Extract fields from text file.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/extract-fields-from-text-file/m-p/5043836#M95929</link>
      <description>Very true, I should learn not posting that.&lt;BR /&gt;&lt;BR /&gt;(you know how it goes: make a sample file, cat it to check, use command history and start piping..)&lt;BR /&gt;&lt;BR /&gt;Also, sorry for confusing the numbers two and three. That should not happen too often or I'm going to get myself in trouble one day :-)&lt;BR /&gt;&lt;BR /&gt;Cheers</description>
      <pubDate>Wed, 02 May 2007 08:01:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/extract-fields-from-text-file/m-p/5043836#M95929</guid>
      <dc:creator>Wouter Jagers</dc:creator>
      <dc:date>2007-05-02T08:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: Extract fields from text file.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/extract-fields-from-text-file/m-p/5043837#M95930</link>
      <description>Thanks James for your tips on effecting scripting.&lt;BR /&gt;It is good to avoid unnecessary extra command usage.&lt;BR /&gt;&lt;BR /&gt;Learning is never ending process! &lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Rajesh &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 02 May 2007 08:11:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/extract-fields-from-text-file/m-p/5043837#M95930</guid>
      <dc:creator>Rajesh SB</dc:creator>
      <dc:date>2007-05-02T08:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: Extract fields from text file.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/extract-fields-from-text-file/m-p/5043838#M95931</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I am able to extract the last 2 coloumn using below awk command.&lt;BR /&gt;&lt;BR /&gt;# bdf -l | awk 'NF&amp;gt;2 {print $(NF-1),$NF}'&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Rajesh SB&lt;BR /&gt;</description>
      <pubDate>Thu, 03 May 2007 04:31:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/extract-fields-from-text-file/m-p/5043838#M95931</guid>
      <dc:creator>Rajesh SB</dc:creator>
      <dc:date>2007-05-03T04:31:05Z</dc:date>
    </item>
  </channel>
</rss>

