<?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: How to Compare Files one by one using Shell Script in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184043#M91206</link>
    <description>Hello&lt;BR /&gt;&lt;BR /&gt;These are the text files and I mentioned that I wanted to compare these files line by line.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Padma</description>
    <pubDate>Mon, 21 Apr 2008 19:45:08 GMT</pubDate>
    <dc:creator>Padma Asrani</dc:creator>
    <dc:date>2008-04-21T19:45:08Z</dc:date>
    <item>
      <title>How to Compare Files one by one using Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184041#M91204</link>
      <description>Hello All&lt;BR /&gt;&lt;BR /&gt;I have two directories and I wanted to compare files one by one in these directories using shell script. Can anybody help how should I start looping through files in each directory and compare these line by line and get the difference?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Padma</description>
      <pubDate>Mon, 21 Apr 2008 19:31:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184041#M91204</guid>
      <dc:creator>Padma Asrani</dc:creator>
      <dc:date>2008-04-21T19:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to Compare Files one by one using Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184042#M91205</link>
      <description>2 directories, compare files.....&lt;BR /&gt;&lt;BR /&gt;you're going to have to be a little more specific...&lt;BR /&gt;&lt;BR /&gt;Compare file names only?&lt;BR /&gt;Compare like named files?&lt;BR /&gt;Text only, or are there binaries, such as executables?&lt;BR /&gt;Desired output?&lt;BR /&gt;&lt;BR /&gt;"man diff".....</description>
      <pubDate>Mon, 21 Apr 2008 19:41:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184042#M91205</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2008-04-21T19:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to Compare Files one by one using Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184043#M91206</link>
      <description>Hello&lt;BR /&gt;&lt;BR /&gt;These are the text files and I mentioned that I wanted to compare these files line by line.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Padma</description>
      <pubDate>Mon, 21 Apr 2008 19:45:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184043#M91206</guid>
      <dc:creator>Padma Asrani</dc:creator>
      <dc:date>2008-04-21T19:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to Compare Files one by one using Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184044#M91207</link>
      <description>Hi Padma:&lt;BR /&gt;&lt;BR /&gt;Have a look at the manpages for 'diff' and for 'dircmp':&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://docs.hp.com/en/B3921-60631/diff.1.html" target="_blank"&gt;http://docs.hp.com/en/B3921-60631/diff.1.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://docs.hp.com/en/B3921-60631/dircmp.1.html" target="_blank"&gt;http://docs.hp.com/en/B3921-60631/dircmp.1.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 21 Apr 2008 19:49:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184044#M91207</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-04-21T19:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to Compare Files one by one using Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184045#M91208</link>
      <description>Since you've not given us much to go on, I'll have to just make assumptions.&lt;BR /&gt;&lt;BR /&gt;Assumptions:&lt;BR /&gt;1) both directories have all the same number of files, only their content may be different.&lt;BR /&gt;2) both directories are siblings of the same parent directory.&lt;BR /&gt;3) There are no subdirectories that you want to scan.&lt;BR /&gt;4) There are no missing files that you are, or are not trying to compare.&lt;BR /&gt;5) The two sibling directories are named "a" and "b". And they are children of the current directory "." &lt;BR /&gt;&lt;BR /&gt;$&amp;gt; cd a&lt;BR /&gt;for i in *&lt;BR /&gt;do&lt;BR /&gt;diff $i ../b/$i&lt;BR /&gt;done</description>
      <pubDate>Mon, 21 Apr 2008 19:53:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184045#M91208</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2008-04-21T19:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to Compare Files one by one using Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184046#M91209</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;a call of&lt;BR /&gt;dircmp -d -s dira dirb&lt;BR /&gt;&lt;BR /&gt;will&lt;BR /&gt;- no identical file&lt;BR /&gt;- flag files only present in one of the directories&lt;BR /&gt;- list a diff-report of identical filenames in both directories&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Mon, 21 Apr 2008 20:01:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184046#M91209</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2008-04-21T20:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to Compare Files one by one using Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184047#M91210</link>
      <description>Wow,&lt;BR /&gt;&lt;BR /&gt;I forgot all about dircmp.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Do what they say, use dircmp.</description>
      <pubDate>Mon, 21 Apr 2008 20:08:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184047#M91210</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2008-04-21T20:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to Compare Files one by one using Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184048#M91211</link>
      <description>ok. People thanks  a lot. I am trying all the options. Thanks so much to all.</description>
      <pubDate>Mon, 21 Apr 2008 20:13:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184048#M91211</guid>
      <dc:creator>Padma Asrani</dc:creator>
      <dc:date>2008-04-21T20:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to Compare Files one by one using Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184049#M91212</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;Some more clarification. Both the directories have some files common and also files which are in one directory but not in other. How to get the list of uncommon files?&lt;BR /&gt;&lt;BR /&gt;Secondly I am not sure i m not able to find dircmp on my linux box.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Padma</description>
      <pubDate>Tue, 22 Apr 2008 16:22:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184049#M91212</guid>
      <dc:creator>Padma Asrani</dc:creator>
      <dc:date>2008-04-22T16:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to Compare Files one by one using Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184050#M91213</link>
      <description>From the dircmp man page:&lt;BR /&gt;&lt;BR /&gt;WARNINGS&lt;BR /&gt;      This command is likely to be withdrawn from X/Open standards. Applications using this command might not be portable to other vendors' systems.  As an alternative diff -R is recommended.&lt;BR /&gt;&lt;BR /&gt;You might want to take a look at diff -R.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Tue, 22 Apr 2008 16:28:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184050#M91213</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2008-04-22T16:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to Compare Files one by one using Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184051#M91214</link>
      <description>&lt;!--!*#--&gt;Hi Padma:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Both the directories have some files common and also files which are in one directory but not in other. How to get the list of uncommon files?&lt;BR /&gt;&lt;BR /&gt;Using 'diff' would show you this automatically.  Consider:&lt;BR /&gt;&lt;BR /&gt;# ls /tmp/dir1 /tmp/dir2&lt;BR /&gt;&lt;BR /&gt;/tmp/dir1:&lt;BR /&gt;hosts       inetd.conf&lt;BR /&gt;&lt;BR /&gt;/tmp/dir2:&lt;BR /&gt;hosts     services&lt;BR /&gt;&lt;BR /&gt;# diff /tmp/dir1 /tmp/dir2&lt;BR /&gt;17c17&lt;BR /&gt;&amp;lt; 127.0.0.1     LOCALHOST       loopback&lt;BR /&gt;---&lt;BR /&gt;&amp;gt; 127.0.0.1     localhost       loopback&lt;BR /&gt;Only in /tmp/dir1: inetd.conf&lt;BR /&gt;Only in /tmp/dir2: services&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;...at worst, you could 'grep -v "^Only in"' to filter out the unmatched files; or 'grep "^Only in"' to find them!&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Secondly I am not sure i m not able to find dircmp on my linux box.&lt;BR /&gt;&lt;BR /&gt;It probably isn't.  In fact, the manpages for 'dircmp' note, "This command is likely to be withdrawn from X/Open standards.  Applications using this command might not be portable to other vendors' systems.  As an alternative diff -R is recommended."&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Apr 2008 16:36:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184051#M91214</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-04-22T16:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to Compare Files one by one using Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184052#M91215</link>
      <description>Thanks&lt;BR /&gt;&lt;BR /&gt;it does work.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Padma</description>
      <pubDate>Tue, 22 Apr 2008 17:09:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184052#M91215</guid>
      <dc:creator>Padma Asrani</dc:creator>
      <dc:date>2008-04-22T17:09:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to Compare Files one by one using Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184053#M91216</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;I was not able to find diff -R and I just used diff &lt;DIR1&gt; dir2&amp;gt; |grep "^Only in"&lt;BR /&gt;&lt;BR /&gt;diff -R is not supported on my Linux box. I am using Fedora Linux.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Padma&lt;BR /&gt;&lt;/DIR1&gt;</description>
      <pubDate>Tue, 22 Apr 2008 17:12:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184053#M91216</guid>
      <dc:creator>Padma Asrani</dc:creator>
      <dc:date>2008-04-22T17:12:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to Compare Files one by one using Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184054#M91217</link>
      <description>thanks....</description>
      <pubDate>Tue, 22 Apr 2008 17:27:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184054#M91217</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2008-04-22T17:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to Compare Files one by one using Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184055#M91218</link>
      <description>Hi Padma:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; diff -R is not supported on my Linux box. I am using Fedora Linux.&lt;BR /&gt;&lt;BR /&gt;No, but:&lt;BR /&gt;&lt;BR /&gt;# diff -r&lt;BR /&gt;&lt;BR /&gt;...and I'm running Fedora 8 in this case.  &lt;BR /&gt;&lt;BR /&gt;Your first line of defense is to do:&lt;BR /&gt;&lt;BR /&gt;# man diff&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 22 Apr 2008 18:31:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184055#M91218</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-04-22T18:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to Compare Files one by one using Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184056#M91219</link>
      <description>&amp;gt;Both the directories have some files common and also files which are in one directory but not in other. How to get the list of uncommon files?&lt;BR /&gt;&lt;BR /&gt;You can just list both directories and use comm(3) to get this:&lt;BR /&gt;$ ls dir1 &amp;gt; dir_files.1&lt;BR /&gt;$ ls dir2 &amp;gt; dir_files.2&lt;BR /&gt;# Gives files only in dir1&lt;BR /&gt;$ comm -23 dir_files.1 dir_files.2&lt;BR /&gt;# Gives files only in dir2&lt;BR /&gt;$ comm -13 dir_files.1 dir_files.2&lt;BR /&gt;# Gives files that aren't in both:&lt;BR /&gt;# Ones in dir2 are indented&lt;BR /&gt;$ comm -3 dir_files.1 dir_files.2</description>
      <pubDate>Wed, 23 Apr 2008 08:31:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184056#M91219</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-04-23T08:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to Compare Files one by one using Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184057#M91220</link>
      <description>Just an fyi - &lt;BR /&gt;&lt;BR /&gt;I'm guessing you've realized it by now - but you're getting "HPUX" answers because you've posted in the HPUX forum.  There is a Linux forum, in which you're much more likely to get Linux specific help.</description>
      <pubDate>Wed, 23 Apr 2008 13:34:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184057#M91220</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2008-04-23T13:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to Compare Files one by one using Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184058#M91221</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; but you're getting "HPUX" answers because you've posted in the HPUX forum&lt;BR /&gt;&lt;BR /&gt;There was never a specification of what operating system but I think we have covered the options available to (L)UNIX at large.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 23 Apr 2008 13:40:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184058#M91221</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-04-23T13:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to Compare Files one by one using Shell Script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184059#M91222</link>
      <description>Hi Padma,&lt;BR /&gt;&lt;BR /&gt;This one I mostly use:&lt;BR /&gt;&lt;BR /&gt;for i in `find /tmp/dir1 -type f|awk -F/ '{print $NF}'`&lt;BR /&gt;do&lt;BR /&gt;find /tmp/dir2 -type f -exec ll {} \; |grep $i&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Can be ported to any UNIX.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Rasheed Tamton.</description>
      <pubDate>Mon, 28 Apr 2008 11:15:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/how-to-compare-files-one-by-one-using-shell-script/m-p/4184059#M91222</guid>
      <dc:creator>Rasheed Tamton</dc:creator>
      <dc:date>2008-04-28T11:15:52Z</dc:date>
    </item>
  </channel>
</rss>

