<?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: Comparing two files in hp-ux in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148424#M90591</link>
    <description>There is a slight problem with the grep solution: if you have a line in file1 containing a subset of a line in file2, it will still skip the line in file2.&lt;BR /&gt;&lt;BR /&gt;Example:&lt;BR /&gt; file1 contains a line consisting of a single '1'&lt;BR /&gt;Then all lines containing a '1' in file2 are skipped.&lt;BR /&gt;&lt;BR /&gt;comm handles this better.&lt;BR /&gt;Also: mind that you want to find data in file1 that's not in file2. Meaning you want to do it the other way around: skip lines in file 1 that's not in file2.&lt;BR /&gt;&lt;BR /&gt;A solution for the grep problem is to create a temporary file, containing all lines from file2 with a ^ prepended and a $ appended to each line.&lt;BR /&gt;&lt;BR /&gt;Or use the -w flag for grep.&lt;BR /&gt;</description>
    <pubDate>Fri, 22 Feb 2008 12:22:05 GMT</pubDate>
    <dc:creator>Elmar P. Kolkman</dc:creator>
    <dc:date>2008-02-22T12:22:05Z</dc:date>
    <item>
      <title>Comparing two files in hp-ux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148414#M90581</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I am trying to compare two files in hp-ux using diff command.&lt;BR /&gt;&lt;BR /&gt;but I am not getting the proper output.&lt;BR /&gt;&lt;BR /&gt;The following command I am using to find out what is in the&lt;BR /&gt;second file but not in the first file.&lt;BR /&gt;&lt;BR /&gt;# diff  file1.txt file2.txt | sed -e 's//file2content/'&lt;BR /&gt;&lt;BR /&gt;Can anyone help me on this.&lt;BR /&gt;&lt;BR /&gt;Is there any other command to achive the same goal?</description>
      <pubDate>Thu, 21 Feb 2008 12:38:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148414#M90581</guid>
      <dc:creator>vvsha</dc:creator>
      <dc:date>2008-02-21T12:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two files in hp-ux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148415#M90582</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;the diff does the comparation - right?&lt;BR /&gt;It seems, you want to something more - what?&lt;BR /&gt;&lt;BR /&gt;The 'man diff' gives you options for modifying output or even (-e') generates ed-commands to create file2 from file1.&lt;BR /&gt;&lt;BR /&gt;See 'man sdiff' for a side-by-sside diff.&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Thu, 21 Feb 2008 12:45:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148415#M90582</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2008-02-21T12:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two files in hp-ux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148416#M90583</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;You probably want to use 'comm(1)'.  See the manpages for more information.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 21 Feb 2008 12:47:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148416#M90583</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-02-21T12:47:30Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two files in hp-ux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148417#M90584</link>
      <description>Use grep:&lt;BR /&gt;&lt;BR /&gt;grep -vf file1 file2&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;ivan</description>
      <pubDate>Thu, 21 Feb 2008 12:48:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148417#M90584</guid>
      <dc:creator>Ivan Krastev</dc:creator>
      <dc:date>2008-02-21T12:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two files in hp-ux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148418#M90585</link>
      <description>&lt;BR /&gt;What is the proper output you expect?&lt;BR /&gt;&lt;BR /&gt; and what output are you receiving?&lt;BR /&gt; and what inputs are you using?&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Feb 2008 12:57:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148418#M90585</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2008-02-21T12:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two files in hp-ux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148419#M90586</link>
      <description>I have two files and both the files has some data inside, and some of the data are similer also. &lt;BR /&gt;&lt;BR /&gt;I want to find out what is the data in the first file which is not present in the second file.&lt;BR /&gt;&lt;BR /&gt;Is there any way to find out?&lt;BR /&gt;&lt;BR /&gt;Please help me on this&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Feb 2008 14:35:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148419#M90586</guid>
      <dc:creator>vvsha</dc:creator>
      <dc:date>2008-02-21T14:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two files in hp-ux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148420#M90587</link>
      <description>is this wat you like:&lt;BR /&gt;sort -n file1.txt &amp;gt; 1&lt;BR /&gt;sort -n file2.tx1 &amp;gt; 2&lt;BR /&gt;diff 1 2 |grep ^"&amp;lt;"</description>
      <pubDate>Thu, 21 Feb 2008 14:42:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148420#M90587</guid>
      <dc:creator>F Verschuren</dc:creator>
      <dc:date>2008-02-21T14:42:41Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two files in hp-ux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148421#M90588</link>
      <description>Like JRF pointed out the comm command:&lt;BR /&gt;&lt;BR /&gt;comm -3 file1.txt file2.txt&lt;BR /&gt;&lt;BR /&gt;Provided both files are sorted.&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Thu, 21 Feb 2008 15:40:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148421#M90588</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2008-02-21T15:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two files in hp-ux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148422#M90589</link>
      <description>Hi,&lt;BR /&gt;sort file1 -o file1.sorted&lt;BR /&gt;sort file2 -o file2.sorted&lt;BR /&gt;grep vf file1.sorted fle2.sorted&lt;BR /&gt;HTH,&lt;BR /&gt;Art</description>
      <pubDate>Fri, 22 Feb 2008 07:40:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148422#M90589</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2008-02-22T07:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two files in hp-ux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148423#M90590</link>
      <description>As others have mentioned, you can use comm(1) or grep -vf to find all lines in the second but not the first.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;harry: comm -3 file1.txt file2.txt&lt;BR /&gt;&lt;BR /&gt;A slight correction, comm -13 will only print the lines from file 2.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Arturo: sort file1 -o file1.sorted&lt;BR /&gt;&lt;BR /&gt;I'm not sure why you want to sort the files unless you want to use comm(1)?  You may want to use sort -u, if you don't want to see you have N lines (all the same) not in file1.&lt;BR /&gt;&lt;BR /&gt;Note: Using sort (twice) and comm would be faster than grep -v, if you have 10s of thousands of lines.</description>
      <pubDate>Fri, 22 Feb 2008 10:34:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148423#M90590</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-02-22T10:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two files in hp-ux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148424#M90591</link>
      <description>There is a slight problem with the grep solution: if you have a line in file1 containing a subset of a line in file2, it will still skip the line in file2.&lt;BR /&gt;&lt;BR /&gt;Example:&lt;BR /&gt; file1 contains a line consisting of a single '1'&lt;BR /&gt;Then all lines containing a '1' in file2 are skipped.&lt;BR /&gt;&lt;BR /&gt;comm handles this better.&lt;BR /&gt;Also: mind that you want to find data in file1 that's not in file2. Meaning you want to do it the other way around: skip lines in file 1 that's not in file2.&lt;BR /&gt;&lt;BR /&gt;A solution for the grep problem is to create a temporary file, containing all lines from file2 with a ^ prepended and a $ appended to each line.&lt;BR /&gt;&lt;BR /&gt;Or use the -w flag for grep.&lt;BR /&gt;</description>
      <pubDate>Fri, 22 Feb 2008 12:22:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148424#M90591</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2008-02-22T12:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two files in hp-ux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148425#M90592</link>
      <description>&amp;gt;Elmar: There is a slight problem with the grep solution&lt;BR /&gt;&amp;gt;Or use the -w flag for grep.&lt;BR /&gt;&lt;BR /&gt;Oops, right.  The -x flag compares the entire line.  Unfortunately it still looks at patterns so you need fgrep:&lt;BR /&gt;fgrep -xvf file1 file2&lt;BR /&gt;</description>
      <pubDate>Fri, 22 Feb 2008 23:25:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/comparing-two-files-in-hp-ux/m-p/4148425#M90592</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-02-22T23:25:58Z</dc:date>
    </item>
  </channel>
</rss>

