<?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: diff - scripts in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/diff-scripts/m-p/5048682#M434429</link>
    <description>If it's always going to be the two most recent files in the directory, then this should work:&lt;BR /&gt;&lt;BR /&gt;diff `ls -t|head -2`&lt;BR /&gt;&lt;BR /&gt;(Note that those are back-quotes.  The ls will list with the most recent file first, and the head will give the first two.)&lt;BR /&gt;&lt;BR /&gt;Andrew&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 23 May 2007 12:24:59 GMT</pubDate>
    <dc:creator>Andrew Merritt_2</dc:creator>
    <dc:date>2007-05-23T12:24:59Z</dc:date>
    <item>
      <title>diff - scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/diff-scripts/m-p/5048675#M434422</link>
      <description>Hello guys!&lt;BR /&gt;&lt;BR /&gt;Please I need a help.&lt;BR /&gt;&lt;BR /&gt;I'm using HPUX 11&lt;BR /&gt;&lt;BR /&gt;I have two files called 05_05_2007.txt and 06_05_2007.txt in the directory /tmp&lt;BR /&gt;&lt;BR /&gt;-rw-rw-rw-   1 F0104582   fnusr           22 May 23 10:56 05_05_2007.txt&lt;BR /&gt;-rw-rw-rw-   1 F0104582   fnusr           59 May 23 10:57 06_05_2007.txt&lt;BR /&gt;&lt;BR /&gt;I need to do a script that to compare theses two files.&lt;BR /&gt;BUT everday theses files will change his names because I create according with the currente date&lt;BR /&gt;&lt;BR /&gt;Today I need to compare the file of today with the file of yesterday and tomorrow the same thing. &lt;BR /&gt;In other words, everyday I need to compare the actual file with the file of the day before.&lt;BR /&gt;&lt;BR /&gt;For exampple:&lt;BR /&gt;#:/diff 05_05_2007.txt 06_05_2007.txt &amp;gt; a.txt&lt;BR /&gt;&lt;BR /&gt;I don't know how can I get theses files in the directory.&lt;BR /&gt;&lt;BR /&gt;#:/diff $A $B &amp;gt; a.txt&lt;BR /&gt;&lt;BR /&gt;How can I do it automatically? I will put this script in the crontab.&lt;BR /&gt;&lt;BR /&gt;Please could someone give me a help?&lt;BR /&gt;&lt;BR /&gt;Thanks a lot!&lt;BR /&gt;clefeitosa</description>
      <pubDate>Wed, 23 May 2007 09:59:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/diff-scripts/m-p/5048675#M434422</guid>
      <dc:creator>cfeitosa</dc:creator>
      <dc:date>2007-05-23T09:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: diff - scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/diff-scripts/m-p/5048676#M434423</link>
      <description>First download the attached script, caljd.sh, and install it in a convenient directory such as /usr/local/bin.&lt;BR /&gt;&lt;BR /&gt;The rest is then trivially simple.&lt;BR /&gt;&lt;BR /&gt;----------------------------------------&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;export PATH=${PATH}:/usr/local/bin&lt;BR /&gt;&lt;BR /&gt;TODAY="$(caljd.sh -e -S "_" $(caljd.sh)).txt"&lt;BR /&gt;YESTERDAY="$(caljd.sh -e -S "_" $(caljd.sh -p 1)).txt"&lt;BR /&gt;&lt;BR /&gt;echo "Today File = ${TODAY}"&lt;BR /&gt;echo "Yesterday File = ${YESTERDAY}"&lt;BR /&gt;---------------------------------------&lt;BR /&gt;&lt;BR /&gt;Invoke as caljd.sh -u for full usage and many examples.&lt;BR /&gt;</description>
      <pubDate>Wed, 23 May 2007 10:18:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/diff-scripts/m-p/5048676#M434423</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-05-23T10:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: diff - scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/diff-scripts/m-p/5048677#M434424</link>
      <description>Hi Clay,&lt;BR /&gt;&lt;BR /&gt;Thanks for your answer but I don't install something. This script is very good but I think that isn't necessary for me. I would like something simplier.&lt;BR /&gt;&lt;BR /&gt;Anyway, thank you very much... I'm studying about it and if someone knows anything more, please...&lt;BR /&gt;</description>
      <pubDate>Wed, 23 May 2007 11:35:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/diff-scripts/m-p/5048677#M434424</guid>
      <dc:creator>cfeitosa</dc:creator>
      <dc:date>2007-05-23T11:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: diff - scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/diff-scripts/m-p/5048678#M434425</link>
      <description>You could play with the TZ environment variable, for example:&lt;BR /&gt;&lt;BR /&gt;# export TZ="GMT"&lt;BR /&gt;# date +%d_%m_%Y&lt;BR /&gt;23_05_2007&lt;BR /&gt;# export TZ="GMT+24"&lt;BR /&gt;# date +%d_%m_%Y&lt;BR /&gt;22_05_2007&lt;BR /&gt;# unset TZ&lt;BR /&gt;</description>
      <pubDate>Wed, 23 May 2007 11:42:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/diff-scripts/m-p/5048678#M434425</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2007-05-23T11:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: diff - scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/diff-scripts/m-p/5048679#M434426</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;ls -1 [0-3][0-9]_[01][0-9]_2[0-9][0-9][0-9].txt | sort -n -t'_' -k3 -k2 -k1 | tail -n 2 | xargs diff &amp;gt; a.txt&lt;BR /&gt;&lt;BR /&gt;PCS</description>
      <pubDate>Wed, 23 May 2007 11:51:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/diff-scripts/m-p/5048679#M434426</guid>
      <dc:creator>spex</dc:creator>
      <dc:date>2007-05-23T11:51:11Z</dc:date>
    </item>
    <item>
      <title>Re: diff - scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/diff-scripts/m-p/5048680#M434427</link>
      <description>Subtracting 24 hours from TZ, if it works, it works by accident, and is very dependent upon your TZ.&lt;BR /&gt;&lt;BR /&gt;Since you didn't like caljd.sh (I assume you did a chmod 755 caljd.sh after you copied it) then this shell script which calls a Perl one-liner should work:&lt;BR /&gt;&lt;BR /&gt;-----------------------------------------&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;TODAY=$(perl -e '($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time()); printf("%02d_%02d_%04d.txt\n",$mday,$mon + 1,$year + 1900)')&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;YESTERDAY=$(perl -e '($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time() - (86400 * 1)); printf("%02d_%02d_%04d.txt\n",$mday,$mon + 1,$year + 1900);')&lt;BR /&gt;&lt;BR /&gt;echo "Today File = ${TODAY}"&lt;BR /&gt;echo "Yesterday File = ${YESTERDAY}"&lt;BR /&gt;&lt;BR /&gt;-----------------------------------------&lt;BR /&gt;&lt;BR /&gt;Now, caljd.sh (or the equivalent caljd.pl Perl version) is a big script but who cares? You only call it --- and if you start using it for date calculations of any kind, I'm pretty sure that you won't use anything else.&lt;BR /&gt;</description>
      <pubDate>Wed, 23 May 2007 12:10:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/diff-scripts/m-p/5048680#M434427</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-05-23T12:10:17Z</dc:date>
    </item>
    <item>
      <title>Re: diff - scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/diff-scripts/m-p/5048681#M434428</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;If you simply want today and yesterday returned in the format "dd_mm_yyyy":&lt;BR /&gt;&lt;BR /&gt;# TODAY=`perl -MPOSIX -le 'print strftime "%d_%m_%Y",localtime'`&lt;BR /&gt;&lt;BR /&gt;# YESTERDAY=`perl -MPOSIX -le 'print strftime "%d_%m_%Y",localtime(time-86400)'`&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 23 May 2007 12:13:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/diff-scripts/m-p/5048681#M434428</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-05-23T12:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: diff - scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/diff-scripts/m-p/5048682#M434429</link>
      <description>If it's always going to be the two most recent files in the directory, then this should work:&lt;BR /&gt;&lt;BR /&gt;diff `ls -t|head -2`&lt;BR /&gt;&lt;BR /&gt;(Note that those are back-quotes.  The ls will list with the most recent file first, and the head will give the first two.)&lt;BR /&gt;&lt;BR /&gt;Andrew&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 23 May 2007 12:24:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/diff-scripts/m-p/5048682#M434429</guid>
      <dc:creator>Andrew Merritt_2</dc:creator>
      <dc:date>2007-05-23T12:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: diff - scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/diff-scripts/m-p/5048683#M434430</link>
      <description>Hello!&lt;BR /&gt;&lt;BR /&gt;Thank you very much for all answers!!!&lt;BR /&gt;Was very useful!&lt;BR /&gt;&lt;BR /&gt;I'll use Andrew's suggestion.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;clefeitosa</description>
      <pubDate>Wed, 23 May 2007 13:59:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/diff-scripts/m-p/5048683#M434430</guid>
      <dc:creator>cfeitosa</dc:creator>
      <dc:date>2007-05-23T13:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: diff - scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/diff-scripts/m-p/5048684#M434431</link>
      <description>Thanks</description>
      <pubDate>Wed, 23 May 2007 14:00:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/diff-scripts/m-p/5048684#M434431</guid>
      <dc:creator>cfeitosa</dc:creator>
      <dc:date>2007-05-23T14:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: diff - scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/diff-scripts/m-p/5048685#M434432</link>
      <description>&amp;gt;Andrew: (Note that those are back-quotes. &lt;BR /&gt;&lt;BR /&gt;If you used the following you wouldn't have to say that:&lt;BR /&gt;$ diff $(ls -t|head -2)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;BUT everday theses files will change his names because I create according with the current date&lt;BR /&gt;&lt;BR /&gt;If you have more complicated case where the files are changing, you could try setting symlinks to point to the last 2 files.  Have a LAST link and a PREV link.  When creating a new file, remove PREV, rename LAST to PREV and link the new name to LAST.&lt;BR /&gt;&lt;BR /&gt;Note it would be better to create the files with YYYY_MM_DD.&lt;BR /&gt;&lt;BR /&gt;A simple script using sed can be used to rename all of your existing files.</description>
      <pubDate>Thu, 24 May 2007 00:13:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/diff-scripts/m-p/5048685#M434432</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-05-24T00:13:49Z</dc:date>
    </item>
  </channel>
</rss>

