<?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 What command to use to trap differences between two files? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-use-to-trap-differences-between-two-files/m-p/2592542#M33065</link>
    <description>Good morning everyone,&lt;BR /&gt;&lt;BR /&gt;I'm revising a script that among other things ensures that my /etc/inetd.conf isn't modified without my knowing it.  The syntax I'm using now is:&lt;BR /&gt;&lt;BR /&gt;diff file1 fileb | wc -w | awk '{print $1}'&lt;BR /&gt;&lt;BR /&gt;if the output of that is greater than 0, I echo a message to sendmail which then notifies me of a change.  WHAT I'D LIKE TO DO is to have the file comparison trap the difference and send THAT to sendmail so I could see exactly WHAT had changed.  I've looked at diff, cmp, uniq and a few others but haven't (apparantly) seen what I need.  Does someone have a suggestion on this?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Joe Robinson</description>
    <pubDate>Wed, 10 Oct 2001 14:27:45 GMT</pubDate>
    <dc:creator>Joe Robinson_2</dc:creator>
    <dc:date>2001-10-10T14:27:45Z</dc:date>
    <item>
      <title>What command to use to trap differences between two files?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-use-to-trap-differences-between-two-files/m-p/2592542#M33065</link>
      <description>Good morning everyone,&lt;BR /&gt;&lt;BR /&gt;I'm revising a script that among other things ensures that my /etc/inetd.conf isn't modified without my knowing it.  The syntax I'm using now is:&lt;BR /&gt;&lt;BR /&gt;diff file1 fileb | wc -w | awk '{print $1}'&lt;BR /&gt;&lt;BR /&gt;if the output of that is greater than 0, I echo a message to sendmail which then notifies me of a change.  WHAT I'D LIKE TO DO is to have the file comparison trap the difference and send THAT to sendmail so I could see exactly WHAT had changed.  I've looked at diff, cmp, uniq and a few others but haven't (apparantly) seen what I need.  Does someone have a suggestion on this?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Joe Robinson</description>
      <pubDate>Wed, 10 Oct 2001 14:27:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-use-to-trap-differences-between-two-files/m-p/2592542#M33065</guid>
      <dc:creator>Joe Robinson_2</dc:creator>
      <dc:date>2001-10-10T14:27:45Z</dc:date>
    </item>
    <item>
      <title>Re: What command to use to trap differences between two files?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-use-to-trap-differences-between-two-files/m-p/2592543#M33066</link>
      <description>Hi Joe,&lt;BR /&gt;Why can't you send output of your diff file1 file2 output to email&lt;BR /&gt;&lt;BR /&gt;Forexample&lt;BR /&gt;diff file1 file2 |wc -w |awk .....&lt;BR /&gt;if result=0 then exit&lt;BR /&gt;else diff file1 file2 |mailx -s &lt;SOME options=""&gt;&lt;BR /&gt;&lt;BR /&gt;Sachin&lt;/SOME&gt;</description>
      <pubDate>Wed, 10 Oct 2001 14:32:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-use-to-trap-differences-between-two-files/m-p/2592543#M33066</guid>
      <dc:creator>Sachin Patel</dc:creator>
      <dc:date>2001-10-10T14:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: What command to use to trap differences between two files?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-use-to-trap-differences-between-two-files/m-p/2592544#M33067</link>
      <description>Hi Joe:&lt;BR /&gt;&lt;BR /&gt;try sdiff -s file1 file2. Man sdiff for details.&lt;BR /&gt;&lt;BR /&gt;Clay</description>
      <pubDate>Wed, 10 Oct 2001 14:33:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-use-to-trap-differences-between-two-files/m-p/2592544#M33067</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-10-10T14:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: What command to use to trap differences between two files?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-use-to-trap-differences-between-two-files/m-p/2592545#M33068</link>
      <description>The output of diff will show you the changes made.</description>
      <pubDate>Wed, 10 Oct 2001 14:33:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-use-to-trap-differences-between-two-files/m-p/2592545#M33068</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2001-10-10T14:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: What command to use to trap differences between two files?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-use-to-trap-differences-between-two-files/m-p/2592546#M33069</link>
      <description>YOu can try this small script&lt;BR /&gt;&lt;BR /&gt;diff file1 file2&lt;BR /&gt;if [ $? != 0 ]&lt;BR /&gt;then&lt;BR /&gt;sdiff -s file1 file2 |mailx -s "File 1 changed" your_id&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Wed, 10 Oct 2001 14:53:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-use-to-trap-differences-between-two-files/m-p/2592546#M33069</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2001-10-10T14:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: What command to use to trap differences between two files?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-use-to-trap-differences-between-two-files/m-p/2592547#M33070</link>
      <description>Hello Joe,&lt;BR /&gt;&lt;BR /&gt;to be cautious about CPU time and such:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;TMP=/tmp/diff.$$&lt;BR /&gt;MAIL=you@your.domain&lt;BR /&gt;file1=$1&lt;BR /&gt;file2=$2&lt;BR /&gt;trap "rm -f $TMP" 0&lt;BR /&gt;if diff $file1 $file2 &amp;gt; $TMP&lt;BR /&gt;then mailx -s"differences" $MAIL &amp;lt; $TMP&lt;BR /&gt;exit 1&lt;BR /&gt;fi&lt;BR /&gt;exit 0&lt;BR /&gt;# end&lt;BR /&gt;&lt;BR /&gt;Just my ?0.02,&lt;BR /&gt;Wodisch</description>
      <pubDate>Wed, 10 Oct 2001 15:01:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-command-to-use-to-trap-differences-between-two-files/m-p/2592547#M33070</guid>
      <dc:creator>Wodisch</dc:creator>
      <dc:date>2001-10-10T15:01:05Z</dc:date>
    </item>
  </channel>
</rss>

