<?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 How to select a string from a file in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-select-a-string-from-a-file/m-p/5136748#M451545</link>
    <description>I have a file (file1) containing unique numbers, that I want to use to extract information from another file (file2). &lt;BR /&gt;file1 has the following contents - &lt;BR /&gt;14&lt;BR /&gt;15&lt;BR /&gt;20&lt;BR /&gt;201&lt;BR /&gt;202&lt;BR /&gt;&lt;BR /&gt;file2 has the following text -&lt;BR /&gt;RaidGroup ID 14 Logical Capacity 23456 Free Capacity 12345&lt;BR /&gt;RaidGroup ID 20 Logical Capacity 23456 Free Capacity 12341&lt;BR /&gt;RaidGroup ID 204 Logical Capacity 23456 Free Capacity 12342&lt;BR /&gt;RaidGroup ID 202 Logical Capacity 23456 Free Capacity 12343&lt;BR /&gt;RaidGroup ID 2 Logical Capacity 23456 Free Capacity 12344&lt;BR /&gt;&lt;BR /&gt;For each entry in file1 (which is field 3 in file2), I have to extract Free Capacity from file2. How do I structure my query so that when I awk for 20, I don't get results for 202 &amp;amp; 204 as well.&lt;BR /&gt;&lt;BR /&gt;for x in `cat file1`&lt;BR /&gt;do&lt;BR /&gt;awk '$3 ~ /$x/' file2|awk '{print $NF}'&lt;BR /&gt;# The above line also gives error&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
    <pubDate>Tue, 21 Oct 2008 18:30:38 GMT</pubDate>
    <dc:creator>Kellogg Unix Team</dc:creator>
    <dc:date>2008-10-21T18:30:38Z</dc:date>
    <item>
      <title>How to select a string from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-select-a-string-from-a-file/m-p/5136748#M451545</link>
      <description>I have a file (file1) containing unique numbers, that I want to use to extract information from another file (file2). &lt;BR /&gt;file1 has the following contents - &lt;BR /&gt;14&lt;BR /&gt;15&lt;BR /&gt;20&lt;BR /&gt;201&lt;BR /&gt;202&lt;BR /&gt;&lt;BR /&gt;file2 has the following text -&lt;BR /&gt;RaidGroup ID 14 Logical Capacity 23456 Free Capacity 12345&lt;BR /&gt;RaidGroup ID 20 Logical Capacity 23456 Free Capacity 12341&lt;BR /&gt;RaidGroup ID 204 Logical Capacity 23456 Free Capacity 12342&lt;BR /&gt;RaidGroup ID 202 Logical Capacity 23456 Free Capacity 12343&lt;BR /&gt;RaidGroup ID 2 Logical Capacity 23456 Free Capacity 12344&lt;BR /&gt;&lt;BR /&gt;For each entry in file1 (which is field 3 in file2), I have to extract Free Capacity from file2. How do I structure my query so that when I awk for 20, I don't get results for 202 &amp;amp; 204 as well.&lt;BR /&gt;&lt;BR /&gt;for x in `cat file1`&lt;BR /&gt;do&lt;BR /&gt;awk '$3 ~ /$x/' file2|awk '{print $NF}'&lt;BR /&gt;# The above line also gives error&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Tue, 21 Oct 2008 18:30:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-select-a-string-from-a-file/m-p/5136748#M451545</guid>
      <dc:creator>Kellogg Unix Team</dc:creator>
      <dc:date>2008-10-21T18:30:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to select a string from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-select-a-string-from-a-file/m-p/5136749#M451546</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;# awk -v x=20 '$3==x' file2&lt;BR /&gt;RaidGroup ID 20 Logical Capacity 23456 Free Capacity 12341&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Tue, 21 Oct 2008 18:51:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-select-a-string-from-a-file/m-p/5136749#M451546</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-10-21T18:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to select a string from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-select-a-string-from-a-file/m-p/5136750#M451547</link>
      <description>Bull's Eye! Thanks JRF!&lt;BR /&gt;&lt;BR /&gt;Here is the quick solution - &lt;BR /&gt;&lt;BR /&gt;for x in `cat file1`&lt;BR /&gt;do&lt;BR /&gt;awk -v x=$x '$3==x' file2&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Thanks again.</description>
      <pubDate>Tue, 21 Oct 2008 19:10:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-select-a-string-from-a-file/m-p/5136750#M451547</guid>
      <dc:creator>Kellogg Unix Team</dc:creator>
      <dc:date>2008-10-21T19:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to select a string from a file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-select-a-string-from-a-file/m-p/5136751#M451548</link>
      <description>&lt;!--!*#--&gt;&amp;gt; [...] so that when I awk for 20, I don't&lt;BR /&gt;&amp;gt; get results for 202 &amp;amp; 204 as well.&lt;BR /&gt;&lt;BR /&gt;Including some white space in your search&lt;BR /&gt;string can help, too.&lt;BR /&gt;&lt;BR /&gt;dy # x=20&lt;BR /&gt;&lt;BR /&gt;dy # grep "$x" file2&lt;BR /&gt;RaidGroup ID 20 Logical Capacity 23456 Free Capacity 12341&lt;BR /&gt;RaidGroup ID 204 Logical Capacity 23456 Free Capacity 12342&lt;BR /&gt;RaidGroup ID 202 Logical Capacity 23456 Free Capacity 12343&lt;BR /&gt;&lt;BR /&gt;dy # grep " $x " file2&lt;BR /&gt;RaidGroup ID 20 Logical Capacity 23456 Free Capacity 12341&lt;BR /&gt;</description>
      <pubDate>Tue, 21 Oct 2008 21:50:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-select-a-string-from-a-file/m-p/5136751#M451548</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2008-10-21T21:50:24Z</dc:date>
    </item>
  </channel>
</rss>

