<?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: what awk statement to use? in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/what-awk-statement-to-use/m-p/5100864#M90889</link>
    <description>You need to give an example of the two files.&lt;BR /&gt;You want to take each of the 12 lines in the first file and find a line in the second that has that line plus a few more fields??  (Or you want to find an exact match?)&lt;BR /&gt;&lt;BR /&gt;If so you can use:&lt;BR /&gt;fgrep -f disk.lst pcm.out</description>
    <pubDate>Tue, 01 Apr 2008 09:12:36 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2008-04-01T09:12:36Z</dc:date>
    <item>
      <title>what awk statement to use?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/what-awk-statement-to-use/m-p/5100863#M90888</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have a file with 12 rows and I want to use awk to search a second file with that particular string:&lt;BR /&gt;&lt;BR /&gt;file to search is pcm.out&lt;BR /&gt;file with data to be searched is disk.lst&lt;BR /&gt;&lt;BR /&gt;so i am looking for a way so that data in disk.lst can be founf in pcm.out.&lt;BR /&gt;&lt;BR /&gt;I was kinda thinking:&lt;BR /&gt;&lt;BR /&gt;awk '$1 ~ /$0/ {print}' pcm.out disk.lst&lt;BR /&gt;&lt;BR /&gt;this dont work ....&lt;BR /&gt;&lt;BR /&gt;any help please?</description>
      <pubDate>Tue, 01 Apr 2008 09:00:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/what-awk-statement-to-use/m-p/5100863#M90888</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2008-04-01T09:00:08Z</dc:date>
    </item>
    <item>
      <title>Re: what awk statement to use?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/what-awk-statement-to-use/m-p/5100864#M90889</link>
      <description>You need to give an example of the two files.&lt;BR /&gt;You want to take each of the 12 lines in the first file and find a line in the second that has that line plus a few more fields??  (Or you want to find an exact match?)&lt;BR /&gt;&lt;BR /&gt;If so you can use:&lt;BR /&gt;fgrep -f disk.lst pcm.out</description>
      <pubDate>Tue, 01 Apr 2008 09:12:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/what-awk-statement-to-use/m-p/5100864#M90889</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-04-01T09:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: what awk statement to use?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/what-awk-statement-to-use/m-p/5100865#M90890</link>
      <description>Does it have to be awk? (why?)&lt;BR /&gt;What constitues a match? anywhere on the line? First field? Leading whitespace optional?&lt;BR /&gt;&lt;BR /&gt;Dennis shows the classic grep solution.&lt;BR /&gt;&lt;BR /&gt;You can do something really similar, buf not the same, with awk.&lt;BR /&gt;&lt;BR /&gt;create disk.lst with slashes surrounding the target strings:&lt;BR /&gt;/string1/&lt;BR /&gt;/string2/&lt;BR /&gt;:&lt;BR /&gt;/last-string/&lt;BR /&gt;&lt;BR /&gt;now run as &lt;BR /&gt;&lt;BR /&gt;awk -f disk.lst pgm.out.&lt;BR /&gt;&lt;BR /&gt;What you really did here is write a minimalistics awk program with as many conditionals/expressions as there are lines and the expression being defaulted to {print $0}.&lt;BR /&gt;&lt;BR /&gt;Note. For the awk program 'disk.lst', just like in the grep case, the pieces of string are regular expressions.&lt;BR /&gt;So a "." matched anything and so on.&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 01 Apr 2008 11:03:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/what-awk-statement-to-use/m-p/5100865#M90890</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-04-01T11:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: what awk statement to use?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/what-awk-statement-to-use/m-p/5100866#M90891</link>
      <description>ok thanks chaps - I need to take the blinkers off as I knew this solution just couldnt think of it!!&lt;BR /&gt;&lt;BR /&gt;Chris.</description>
      <pubDate>Tue, 01 Apr 2008 12:15:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/what-awk-statement-to-use/m-p/5100866#M90891</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2008-04-01T12:15:16Z</dc:date>
    </item>
  </channel>
</rss>

