<?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: shell script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/3560386#M702483</link>
    <description>I like the cut command (Harry's post) best &lt;BR /&gt;But just cause you can do it a million ways, &lt;BR /&gt;here's another way.&lt;BR /&gt;&lt;BR /&gt;cat file1 | sed -e "s/^.* //"</description>
    <pubDate>Wed, 08 Jun 2005 15:54:06 GMT</pubDate>
    <dc:creator>TwoProc</dc:creator>
    <dc:date>2005-06-08T15:54:06Z</dc:date>
    <item>
      <title>shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/3560381#M702478</link>
      <description>Hello, I have two file &lt;BR /&gt;cat file1&lt;BR /&gt;13344 domain0.com&lt;BR /&gt;44555 domain1.com&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;I need filed  2 domains:&lt;BR /&gt;for i in `cat file1|awk '{print $2}'&lt;BR /&gt;do&lt;BR /&gt;......&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;My output , obtain wiht field 1:&lt;BR /&gt;&lt;BR /&gt;13344 domain0.com&lt;BR /&gt;44555 domain1.com&lt;BR /&gt;&lt;BR /&gt;since it could do this&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Jun 2005 10:14:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/3560381#M702478</guid>
      <dc:creator>Jairo Campana</dc:creator>
      <dc:date>2005-06-08T10:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/3560382#M702479</link>
      <description>you seem to be missing the ending `&lt;BR /&gt;&lt;BR /&gt;for i in `cat file1 file2 | awk '{print $2}'`&lt;BR /&gt;&amp;gt; do&lt;BR /&gt;&amp;gt; echo $i&lt;BR /&gt;&amp;gt; done&lt;BR /&gt;&lt;BR /&gt;domain0.com&lt;BR /&gt;domain1.com&lt;BR /&gt;&lt;BR /&gt;assuming you mean want the second field from both files. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Jun 2005 10:33:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/3560382#M702479</guid>
      <dc:creator>Marvin Strong</dc:creator>
      <dc:date>2005-06-08T10:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/3560383#M702480</link>
      <description>Why complicate things with awk and a for loop?&lt;BR /&gt;&lt;BR /&gt; cat file1 file2 | cut -d" " -f2&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry d brown jr</description>
      <pubDate>Wed, 08 Jun 2005 12:38:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/3560383#M702480</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2005-06-08T12:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/3560384#M702481</link>
      <description>The cat is not necessary.&lt;BR /&gt;&lt;BR /&gt;awk '{print $2}' file1 file2&lt;BR /&gt;&lt;BR /&gt;Marlou</description>
      <pubDate>Wed, 08 Jun 2005 14:48:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/3560384#M702481</guid>
      <dc:creator>Marlou Everson</dc:creator>
      <dc:date>2005-06-08T14:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/3560385#M702482</link>
      <description>True,&lt;BR /&gt;&lt;BR /&gt;cut -d" " -f2 file1 file2 ...&lt;BR /&gt;&lt;BR /&gt;cut is at least twice as fast as awk. You can dig a ditch with a shovel, but a backhoe is a real tool.&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry d brown jr</description>
      <pubDate>Wed, 08 Jun 2005 15:02:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/3560385#M702482</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2005-06-08T15:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/3560386#M702483</link>
      <description>I like the cut command (Harry's post) best &lt;BR /&gt;But just cause you can do it a million ways, &lt;BR /&gt;here's another way.&lt;BR /&gt;&lt;BR /&gt;cat file1 | sed -e "s/^.* //"</description>
      <pubDate>Wed, 08 Jun 2005 15:54:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/3560386#M702483</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2005-06-08T15:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/3560387#M702484</link>
      <description>I would suggest, never use a 'cat |' with a filter program.. if you avoid it..&lt;BR /&gt;&lt;BR /&gt;awk '{ print $2 }' file1</description>
      <pubDate>Wed, 08 Jun 2005 16:15:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/3560387#M702484</guid>
      <dc:creator>D Block 2</dc:creator>
      <dc:date>2005-06-08T16:15:20Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/3560388#M702485</link>
      <description>Marwin is right you seem missed ` end&lt;BR /&gt;and i also prefer to use as Tom's suggestion&lt;BR /&gt;awk '{ print $2 }' file1 &lt;BR /&gt;Goo Luck,</description>
      <pubDate>Thu, 09 Jun 2005 00:17:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/3560388#M702485</guid>
      <dc:creator>Cem Tugrul</dc:creator>
      <dc:date>2005-06-09T00:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/3560389#M702486</link>
      <description>You have not told about file2 and what you are expecting from both files?&lt;BR /&gt;&lt;BR /&gt;To get second field from a file you can use awk or cut as,&lt;BR /&gt;&lt;BR /&gt;awk '{ print $2 }' file1&lt;BR /&gt;cut -d" " -f2 file1&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Thu, 09 Jun 2005 00:57:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/3560389#M702486</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-06-09T00:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/3560390#M702487</link>
      <description>I still can get field 2 on my server&lt;BR /&gt;#cat temp&lt;BR /&gt;44555 domain1.com&lt;BR /&gt;44555 domain1.com&lt;BR /&gt;44555 domain1.com&lt;BR /&gt;44555 domain1.com&lt;BR /&gt;44555 domain1.com&lt;BR /&gt;# cat temp|awk '{print $2}'&lt;BR /&gt;domain1.com&lt;BR /&gt;domain1.com&lt;BR /&gt;domain1.com&lt;BR /&gt;domain1.com&lt;BR /&gt;domain1.com&lt;BR /&gt;YOU CAN SET DELIMETER BY -F LIKE THIS&lt;BR /&gt;#cat temp|awk -F ' ' '{print $2}'&lt;BR /&gt;domain1.com&lt;BR /&gt;domain1.com&lt;BR /&gt;domain1.com&lt;BR /&gt;domain1.com&lt;BR /&gt;domain1.com &lt;BR /&gt;#cat temp|awk -F '.' '{print $2}'&lt;BR /&gt;com&lt;BR /&gt;com&lt;BR /&gt;com&lt;BR /&gt;com&lt;BR /&gt;HTH&lt;BR /&gt;tienna</description>
      <pubDate>Thu, 09 Jun 2005 20:43:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/3560390#M702487</guid>
      <dc:creator>Nguyen Anh Tien</dc:creator>
      <dc:date>2005-06-09T20:43:15Z</dc:date>
    </item>
  </channel>
</rss>

