<?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: Get differences between files and removing oldest if different in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/get-differences-between-files-and-removing-oldest-if-different/m-p/3524179#M840940</link>
    <description>Dave,&lt;BR /&gt;use ls -lt to get the files in creation order&lt;BR /&gt;Use the first (newest file) with head and do a diff aginst the next file (second newest).&lt;BR /&gt;If the result is no diff then rm the second file, repeat until all files are done.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;</description>
    <pubDate>Wed, 13 Apr 2005 10:31:24 GMT</pubDate>
    <dc:creator>Peter Godron</dc:creator>
    <dc:date>2005-04-13T10:31:24Z</dc:date>
    <item>
      <title>Get differences between files and removing oldest if different</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/get-differences-between-files-and-removing-oldest-if-different/m-p/3524177#M840938</link>
      <description>Hi.  I need some help, I have a job which generates reports on a regular basis, what I need to do is loop through the files and compare each one with the newest one and if identical I would like to remove the older version.  There will be an unknown number of files. Here is an example listing &lt;BR /&gt;&lt;BR /&gt;/pfile/init_dba18_15491713042005.ora newest&lt;BR /&gt;/pfile/init_dba18_15320613042005.ora&lt;BR /&gt;/pfile/init_dba18_15251313042005.ora&lt;BR /&gt;/pfile/init_dba18_15191313042005.ora&lt;BR /&gt;&lt;BR /&gt;I would like to remove the files with no changes and only keep the newest of the unchanged ones. &lt;BR /&gt;&lt;BR /&gt;Thanks... Dave</description>
      <pubDate>Wed, 13 Apr 2005 10:26:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/get-differences-between-files-and-removing-oldest-if-different/m-p/3524177#M840938</guid>
      <dc:creator>Dave Walley</dc:creator>
      <dc:date>2005-04-13T10:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: Get differences between files and removing oldest if different</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/get-differences-between-files-and-removing-oldest-if-different/m-p/3524178#M840939</link>
      <description>I would suggest the diff command.&lt;BR /&gt;&lt;BR /&gt;diffs=$(diff file1 file2 | wc -l)&lt;BR /&gt;&lt;BR /&gt;You will need a loop to process all the files.&lt;BR /&gt;&lt;BR /&gt;if [ $diffs -ge 1 ] &lt;BR /&gt;then&lt;BR /&gt;   rm file2&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Its a start.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Wed, 13 Apr 2005 10:31:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/get-differences-between-files-and-removing-oldest-if-different/m-p/3524178#M840939</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2005-04-13T10:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: Get differences between files and removing oldest if different</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/get-differences-between-files-and-removing-oldest-if-different/m-p/3524179#M840940</link>
      <description>Dave,&lt;BR /&gt;use ls -lt to get the files in creation order&lt;BR /&gt;Use the first (newest file) with head and do a diff aginst the next file (second newest).&lt;BR /&gt;If the result is no diff then rm the second file, repeat until all files are done.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;</description>
      <pubDate>Wed, 13 Apr 2005 10:31:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/get-differences-between-files-and-removing-oldest-if-different/m-p/3524179#M840940</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2005-04-13T10:31:24Z</dc:date>
    </item>
    <item>
      <title>Re: Get differences between files and removing oldest if different</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/get-differences-between-files-and-removing-oldest-if-different/m-p/3524180#M840941</link>
      <description>Dave,&lt;BR /&gt;use ls -lt to get the files in creation order&lt;BR /&gt;Use the first (newest file) with head and do a diff aginst the next file (second newest).&lt;BR /&gt;If the result is diff then rm the second file, repeat until all files are done.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;</description>
      <pubDate>Wed, 13 Apr 2005 10:31:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/get-differences-between-files-and-removing-oldest-if-different/m-p/3524180#M840941</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2005-04-13T10:31:34Z</dc:date>
    </item>
  </channel>
</rss>

