<?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: Filter Files.. in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/filter-files/m-p/5103971#M91089</link>
    <description>&amp;gt;Hein: matches as entries in file2 will be treated as regular expressions.&lt;BR /&gt;&lt;BR /&gt;That's why you use -x for whole line and -F for fixed strings:&lt;BR /&gt;fgrep -vx -f file2 file1</description>
    <pubDate>Thu, 17 Apr 2008 03:55:29 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2008-04-17T03:55:29Z</dc:date>
    <item>
      <title>Filter Files..</title>
      <link>https://community.hpe.com/t5/operating-system-linux/filter-files/m-p/5103968#M91086</link>
      <description>Hello everybody,&lt;BR /&gt;&lt;BR /&gt;I have 2 files, for example:&lt;BR /&gt;&lt;BR /&gt;File 1:&lt;BR /&gt;a&lt;BR /&gt;b&lt;BR /&gt;c&lt;BR /&gt;d&lt;BR /&gt;e&lt;BR /&gt;&lt;BR /&gt;File2:&lt;BR /&gt;b&lt;BR /&gt;d&lt;BR /&gt;&lt;BR /&gt;The idea is to read File1 and print all lines except the strings that I have in File2. The result should be:&lt;BR /&gt;&lt;BR /&gt;File3:&lt;BR /&gt;a&lt;BR /&gt;c&lt;BR /&gt;e&lt;BR /&gt;&lt;BR /&gt;Note: The number of lines changes, isn't fix. I have to apply this rotine on oracle files, usually with more than 30000 lines and comparate with other file with 200. &lt;BR /&gt;&lt;BR /&gt;I appreciate if you help in shell script.&lt;BR /&gt;&lt;BR /&gt;Thank you very much&lt;BR /&gt;&lt;BR /&gt;Andre</description>
      <pubDate>Wed, 16 Apr 2008 21:09:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/filter-files/m-p/5103968#M91086</guid>
      <dc:creator>Andre Augusto Ferreira</dc:creator>
      <dc:date>2008-04-16T21:09:05Z</dc:date>
    </item>
    <item>
      <title>Re: Filter Files..</title>
      <link>https://community.hpe.com/t5/operating-system-linux/filter-files/m-p/5103969#M91087</link>
      <description>Hi Andre:&lt;BR /&gt;&lt;BR /&gt;Assuming that the files are sorted; given your files as shown:&lt;BR /&gt;&lt;BR /&gt;# comm -3 file1 file2&lt;BR /&gt;a&lt;BR /&gt;c&lt;BR /&gt;e&lt;BR /&gt;&lt;BR /&gt;...see the manpages for 'comm'.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 16 Apr 2008 22:28:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/filter-files/m-p/5103969#M91087</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-04-16T22:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: Filter Files..</title>
      <link>https://community.hpe.com/t5/operating-system-linux/filter-files/m-p/5103970#M91088</link>
      <description>&amp;gt;&amp;gt; I have to apply this rotine on oracle files&lt;BR /&gt;&lt;BR /&gt;Hmmm.. this is perfect task for a SQL query!&lt;BR /&gt;&lt;BR /&gt;Besides the comm solution JRF mentions, &lt;BR /&gt;the other classic solultion is to grep with a match file:&lt;BR /&gt;&lt;BR /&gt;$ grep -v -f file2 file1&lt;BR /&gt;a&lt;BR /&gt;c&lt;BR /&gt;e&lt;BR /&gt;&lt;BR /&gt;For this solution the files do not need to be sorted but... watch out for surprise matches as entries in file2 will be treated as regulare expressions.&lt;BR /&gt;&lt;BR /&gt;I like perl solutions for this. Stick all lines from the short file in an array. The read the long file and take action based on presence in the array.&lt;BR /&gt;Much similar to the problem in:&lt;BR /&gt;&lt;A href="http://forums12.itrc.hp.com/service/forums/questionanswer.do?threadId=1220926" target="_blank"&gt;http://forums12.itrc.hp.com/service/forums/questionanswer.do?threadId=1220926&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Here:&lt;BR /&gt;&lt;BR /&gt;$ perl -e 'open B,"&lt;FILE2&gt;) {$b{$_}++}; open A,"&lt;FILE1&gt;){print unless $b{$_}}'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/FILE1&gt;&lt;/FILE2&gt;</description>
      <pubDate>Thu, 17 Apr 2008 02:43:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/filter-files/m-p/5103970#M91088</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-04-17T02:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: Filter Files..</title>
      <link>https://community.hpe.com/t5/operating-system-linux/filter-files/m-p/5103971#M91089</link>
      <description>&amp;gt;Hein: matches as entries in file2 will be treated as regular expressions.&lt;BR /&gt;&lt;BR /&gt;That's why you use -x for whole line and -F for fixed strings:&lt;BR /&gt;fgrep -vx -f file2 file1</description>
      <pubDate>Thu, 17 Apr 2008 03:55:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/filter-files/m-p/5103971#M91089</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-04-17T03:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: Filter Files..</title>
      <link>https://community.hpe.com/t5/operating-system-linux/filter-files/m-p/5103972#M91090</link>
      <description>/usr/xpg4/bin/grep -f 2.txt 1.txt &amp;gt; 3.txt&lt;BR /&gt;&lt;BR /&gt;Note don't use the grep in the regular search path as it doesn't suppor the -f option.&lt;BR /&gt;&lt;BR /&gt;Or use fgrep</description>
      <pubDate>Thu, 17 Apr 2008 06:56:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/filter-files/m-p/5103972#M91090</guid>
      <dc:creator>OFC_EDM</dc:creator>
      <dc:date>2008-04-17T06:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: Filter Files..</title>
      <link>https://community.hpe.com/t5/operating-system-linux/filter-files/m-p/5103973#M91091</link>
      <description>/usr/xpg4/bin/grep &lt;BR /&gt;&lt;BR /&gt;I'm assuming you're on HP-UX when providing the above path.</description>
      <pubDate>Thu, 17 Apr 2008 06:57:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/filter-files/m-p/5103973#M91091</guid>
      <dc:creator>OFC_EDM</dc:creator>
      <dc:date>2008-04-17T06:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: Filter Files..</title>
      <link>https://community.hpe.com/t5/operating-system-linux/filter-files/m-p/5103974#M91092</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;O'Kevin : /usr/xpg4/bin/grep&lt;BR /&gt;This is the place, where SOLARIS holds its Posix-compliant commands. HP style would be, to set the environment variable UNIX95, like&lt;BR /&gt;UNIX95= grep ...&lt;BR /&gt;The remark about the different handling of the '-f' option fits to SUN as well, IMHO.&lt;BR /&gt;&lt;BR /&gt;The (new) recommended call under HP-UX (&amp;gt;=11i) seems:&lt;BR /&gt;grep -F -x -f 2.txt 1.txt&lt;BR /&gt;&lt;BR /&gt;mfG Peter&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Apr 2008 09:24:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/filter-files/m-p/5103974#M91092</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2008-04-17T09:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: Filter Files..</title>
      <link>https://community.hpe.com/t5/operating-system-linux/filter-files/m-p/5103975#M91093</link>
      <description>Hi guys,&lt;BR /&gt;&lt;BR /&gt;Thank you very much for the suggestions, I didn't know that grep cold compare 2 files and I was trying to write a script. Your ideas simples and objective is all that I need.&lt;BR /&gt;&lt;BR /&gt;Some notes, the files aren't sorted, and the path /usr/xpg4/bin don't exist. I'll use the UNIX95 variable and treat the files.&lt;BR /&gt;&lt;BR /&gt;Thanks JRF, Hein, Dennis, O'Kevin and Pete.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Andre</description>
      <pubDate>Thu, 17 Apr 2008 13:17:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/filter-files/m-p/5103975#M91093</guid>
      <dc:creator>Andre Augusto Ferreira</dc:creator>
      <dc:date>2008-04-17T13:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: Filter Files..</title>
      <link>https://community.hpe.com/t5/operating-system-linux/filter-files/m-p/5103976#M91094</link>
      <description>Close</description>
      <pubDate>Thu, 17 Apr 2008 13:18:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/filter-files/m-p/5103976#M91094</guid>
      <dc:creator>Andre Augusto Ferreira</dc:creator>
      <dc:date>2008-04-17T13:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: Filter Files..</title>
      <link>https://community.hpe.com/t5/operating-system-linux/filter-files/m-p/5103977#M91095</link>
      <description>&amp;gt;I didn't know that grep could compare 2 files&lt;BR /&gt;&lt;BR /&gt;It doesn't really "compare" but it filters.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;I'll use the UNIX95 variable and treat the files.&lt;BR /&gt;&lt;BR /&gt;No need to use UNIX95 since the fine print only mentioned some some very minor difference dealing with -q and errors.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;O'Kevin: Note don't use the grep in the regular search path as it doesn't support the -f option.&lt;BR /&gt;&lt;BR /&gt;Sure it does.  You must be thinking about some foreign devil version of grep.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Peter: The remark about the different handling of the '-f' option fits to SUN as well.&lt;BR /&gt;&lt;BR /&gt;It may fit SUN but it has nothing to do with HP-UX.</description>
      <pubDate>Thu, 17 Apr 2008 18:27:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/filter-files/m-p/5103977#M91095</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-04-17T18:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: Filter Files..</title>
      <link>https://community.hpe.com/t5/operating-system-linux/filter-files/m-p/5103978#M91096</link>
      <description>You are write Dennis, I realize that I don't need to use UNIX95 as fast I close the discution. Simply execute grep with the parameters that was said.&lt;BR /&gt;&lt;BR /&gt;Thank you for the notes.</description>
      <pubDate>Thu, 17 Apr 2008 22:06:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/filter-files/m-p/5103978#M91096</guid>
      <dc:creator>Andre Augusto Ferreira</dc:creator>
      <dc:date>2008-04-17T22:06:03Z</dc:date>
    </item>
  </channel>
</rss>

