<?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 Match Pattern and delete lines in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/match-pattern-and-delete-lines/m-p/3388934#M714047</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have 2 files one containing some patterns and the other file with lines having the pattern.&lt;BR /&gt;&lt;BR /&gt;I need to read both the files and delete all the lines in file2 which matches the patterns in file1.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Rahul</description>
    <pubDate>Tue, 28 Sep 2004 12:22:51 GMT</pubDate>
    <dc:creator>Rahul_13</dc:creator>
    <dc:date>2004-09-28T12:22:51Z</dc:date>
    <item>
      <title>Match Pattern and delete lines</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/match-pattern-and-delete-lines/m-p/3388934#M714047</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have 2 files one containing some patterns and the other file with lines having the pattern.&lt;BR /&gt;&lt;BR /&gt;I need to read both the files and delete all the lines in file2 which matches the patterns in file1.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Rahul</description>
      <pubDate>Tue, 28 Sep 2004 12:22:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/match-pattern-and-delete-lines/m-p/3388934#M714047</guid>
      <dc:creator>Rahul_13</dc:creator>
      <dc:date>2004-09-28T12:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: Match Pattern and delete lines</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/match-pattern-and-delete-lines/m-p/3388935#M714048</link>
      <description>file1 = file with the patterns&lt;BR /&gt;file2 = file with lines having the pattern&lt;BR /&gt;&lt;BR /&gt;grep -vf file1 file2 &amp;gt; file3&lt;BR /&gt;mv file3 file2</description>
      <pubDate>Tue, 28 Sep 2004 12:28:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/match-pattern-and-delete-lines/m-p/3388935#M714048</guid>
      <dc:creator>Sundar_7</dc:creator>
      <dc:date>2004-09-28T12:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: Match Pattern and delete lines</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/match-pattern-and-delete-lines/m-p/3388936#M714049</link>
      <description>while read -r file1d&lt;BR /&gt;do&lt;BR /&gt;  while read -r file2d&lt;BR /&gt;    do&lt;BR /&gt;    hit=0&lt;BR /&gt;    hit=$(echo $file2d | grep $file1d)&lt;BR /&gt;    if [ $hit -eq 0&lt;BR /&gt;       echo $file2d &amp;gt;&amp;gt; /tmp/newfile2&lt;BR /&gt;    else&lt;BR /&gt;       echo "data reject&lt;BR /&gt;    fi&lt;BR /&gt;    done &amp;lt; /tmp/file2&lt;BR /&gt;done &amp;lt; /tmp/file1&lt;BR /&gt;&lt;BR /&gt;Needs a tweak or two, but this approach might work.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Tue, 28 Sep 2004 12:30:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/match-pattern-and-delete-lines/m-p/3388936#M714049</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-09-28T12:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: Match Pattern and delete lines</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/match-pattern-and-delete-lines/m-p/3388937#M714050</link>
      <description>I believe this is something additional to your yesterday's question. &lt;BR /&gt;you will have to use sed for this. &lt;BR /&gt;&lt;BR /&gt;cat file1 | while read pattern&lt;BR /&gt;do &lt;BR /&gt;grep -v $pattern file2 &amp;gt;&amp;gt; /tmp/file3&lt;BR /&gt;mv file2 file2.old&lt;BR /&gt;mv file3 file2&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Hope this helps&lt;BR /&gt;Prashant</description>
      <pubDate>Tue, 28 Sep 2004 12:32:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/match-pattern-and-delete-lines/m-p/3388937#M714050</guid>
      <dc:creator>Prashant Zanwar_4</dc:creator>
      <dc:date>2004-09-28T12:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: Match Pattern and delete lines</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/match-pattern-and-delete-lines/m-p/3388938#M714051</link>
      <description>While it is multiple pattern, you would like to do like following&lt;BR /&gt;&lt;BR /&gt;cat file 1| while read pat1 pat2 pat3 ..&lt;BR /&gt;do&lt;BR /&gt;egrep -v "$pat1|$pat2|...$patn" file2 &amp;gt;&amp;gt; file3&lt;BR /&gt;..&lt;BR /&gt;..&lt;BR /&gt;..&lt;BR /&gt;&lt;BR /&gt;Hope it helps&lt;BR /&gt;Prashant&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Sep 2004 12:57:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/match-pattern-and-delete-lines/m-p/3388938#M714051</guid>
      <dc:creator>Prashant Zanwar_4</dc:creator>
      <dc:date>2004-09-28T12:57:14Z</dc:date>
    </item>
  </channel>
</rss>

