<?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 Check file script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110970#M313243</link>
    <description># vi file_for_compare&lt;BR /&gt;file1.txt;200712031200&lt;BR /&gt;file2.txt;200712041457&lt;BR /&gt;file3.txt;200712041451&lt;BR /&gt;file4.txt;200712051512&lt;BR /&gt;&lt;BR /&gt;I have a file as above , the format is file name + date &amp;amp; time  , I would like to compare it with the files in a directory as below &lt;BR /&gt;&lt;BR /&gt;#ls /tmp/directory_for_compare&lt;BR /&gt;-rw-r--r-- 1 user edp 4324 Dec 04 14:57 file1&lt;BR /&gt;-rw-r--r-- 1 user edp 4324 Dec 04 14:57 file3&lt;BR /&gt;-rw-r--r-- 1 user edp 4324 Dec 05 18:57 file12&lt;BR /&gt;&lt;BR /&gt; I would like to find out which file is missing for everyday ( what I want to find out  is file name that the file_for_compare have but directory_for_compare don't have and vice versa ) . For example , assume today is 04-Dec , so only compare the file which the creation date is 04-Dec , in the file_for_compare , there are file2 and file3 need to compare , in the directory_for_compare , there are file1 and file3 need to compare ( because only these files creation date is 04-Dec ) , so I would like the output like below :&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;file_for_compare have but directory_for_compare do not have &lt;BR /&gt;"file2"&lt;BR /&gt;&lt;BR /&gt;file_for_compare do not have but directory_for_compare have &lt;BR /&gt;"file1"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If today is 5-Dec , then only compare 5-Dec,  if today is 6-Dec then only 6-Dec etc , no date input is required .&lt;BR /&gt;&lt;BR /&gt;can advise how to write the script ? thx in advance.</description>
    <pubDate>Tue, 04 Dec 2007 07:11:20 GMT</pubDate>
    <dc:creator>ust3</dc:creator>
    <dc:date>2007-12-04T07:11:20Z</dc:date>
    <item>
      <title>Check file script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110970#M313243</link>
      <description># vi file_for_compare&lt;BR /&gt;file1.txt;200712031200&lt;BR /&gt;file2.txt;200712041457&lt;BR /&gt;file3.txt;200712041451&lt;BR /&gt;file4.txt;200712051512&lt;BR /&gt;&lt;BR /&gt;I have a file as above , the format is file name + date &amp;amp; time  , I would like to compare it with the files in a directory as below &lt;BR /&gt;&lt;BR /&gt;#ls /tmp/directory_for_compare&lt;BR /&gt;-rw-r--r-- 1 user edp 4324 Dec 04 14:57 file1&lt;BR /&gt;-rw-r--r-- 1 user edp 4324 Dec 04 14:57 file3&lt;BR /&gt;-rw-r--r-- 1 user edp 4324 Dec 05 18:57 file12&lt;BR /&gt;&lt;BR /&gt; I would like to find out which file is missing for everyday ( what I want to find out  is file name that the file_for_compare have but directory_for_compare don't have and vice versa ) . For example , assume today is 04-Dec , so only compare the file which the creation date is 04-Dec , in the file_for_compare , there are file2 and file3 need to compare , in the directory_for_compare , there are file1 and file3 need to compare ( because only these files creation date is 04-Dec ) , so I would like the output like below :&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;file_for_compare have but directory_for_compare do not have &lt;BR /&gt;"file2"&lt;BR /&gt;&lt;BR /&gt;file_for_compare do not have but directory_for_compare have &lt;BR /&gt;"file1"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If today is 5-Dec , then only compare 5-Dec,  if today is 6-Dec then only 6-Dec etc , no date input is required .&lt;BR /&gt;&lt;BR /&gt;can advise how to write the script ? thx in advance.</description>
      <pubDate>Tue, 04 Dec 2007 07:11:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110970#M313243</guid>
      <dc:creator>ust3</dc:creator>
      <dc:date>2007-12-04T07:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: Check file script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110971#M313244</link>
      <description>&lt;!--!*#--&gt;You need to convert the date to two separate search patterns.  TODAY1 would have problems for files over 6 months old.&lt;BR /&gt;&lt;BR /&gt;TMP=/var/tmp/dc.$$&lt;BR /&gt;&lt;BR /&gt;TODAY1=$(date +"%b %d")&lt;BR /&gt;TODAY2=$(date +"%Y%m%d")&lt;BR /&gt;&lt;BR /&gt;echo $TODAY1  # debugging&lt;BR /&gt;echo $TODAY2  # debugging&lt;BR /&gt;&lt;BR /&gt;awk -F";" -v PAT=$TODAY2 '&lt;BR /&gt;$2 ~ PAT { print $1 }' file_for_compare | sort &amp;gt; $TMP.fff&lt;BR /&gt;&lt;BR /&gt;ll /tmp/directory_for_compare | awk -v PAT="$TODAY1" '&lt;BR /&gt;$0 ~ PAT { print $NF }' | sort &amp;gt; $TMP.dff&lt;BR /&gt;&lt;BR /&gt;echo "Files not in directory:"&lt;BR /&gt;comm -23 $TMP.fff $TMP.dff&lt;BR /&gt;echo "Files not in control file:"&lt;BR /&gt;comm -13 $TMP.fff $TMP.dff&lt;BR /&gt;&lt;BR /&gt;rm -f $TMP.fff $TMP.dff&lt;BR /&gt;</description>
      <pubDate>Tue, 04 Dec 2007 07:41:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110971#M313244</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-12-04T07:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: Check file script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110972#M313245</link>
      <description>thx reply, &lt;BR /&gt;&lt;BR /&gt;I tried the above script , but there is no output , I would like to ask what is PAT mean ? do I still need to modify before use this script ?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;thx</description>
      <pubDate>Tue, 11 Dec 2007 04:00:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110972#M313245</guid>
      <dc:creator>ust3</dc:creator>
      <dc:date>2007-12-11T04:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: Check file script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110973#M313246</link>
      <description>&amp;gt;I tried the above script but there is no output&lt;BR /&gt;&lt;BR /&gt;The script won't give output if "today" isn't in Dec 3 though Dec 5.  You said:&lt;BR /&gt;  If today is 5-Dec, then only compare 5-Dec, if today is 6-Dec then only 6-Dec etc, no date input is required.&lt;BR /&gt;&lt;BR /&gt;I only check the files for today, not every file and entry in file_for_compare.  Also because of that, I don't bother checking hours and minutes.  (Running the script at midnight would have problems.)-:&lt;BR /&gt;&lt;BR /&gt;&amp;gt;would like to ask what is PAT mean? do I still need to modify before use this script?&lt;BR /&gt;&lt;BR /&gt;PAT is the awk string variable that signifies "today" by an exact match.  There are two date "styles" for the two data sources.</description>
      <pubDate>Tue, 11 Dec 2007 04:37:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110973#M313246</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-12-11T04:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: Check file script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110974#M313247</link>
      <description>thx reply ,&lt;BR /&gt;&lt;BR /&gt;I found there is single ' sign in the below statement , is it correct ? thx&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;awk -F";" -v PAT=$TODAY2 '&lt;BR /&gt;$2 ~ PAT { print $1 }' file_for_compare | sort &amp;gt; $TMP.fff&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Dec 2007 05:37:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110974#M313247</guid>
      <dc:creator>ust3</dc:creator>
      <dc:date>2007-12-11T05:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: Check file script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110975#M313248</link>
      <description>&amp;gt;I found there is single ' sign in the below statement, is it correct?&lt;BR /&gt;awk -F";" -v PAT=$TODAY2 '&lt;BR /&gt;$2 ~ PAT { print $1 }' file_for_compare | sort &amp;gt; $TMP.fff&lt;BR /&gt;&lt;BR /&gt;Yes, one on the first line to start the awk script and the other on the last line to end it.  I usually break up complex awk scripts like that but since it is only one line, you can put them together.</description>
      <pubDate>Tue, 11 Dec 2007 05:52:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110975#M313248</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-12-11T05:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: Check file script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110976#M313249</link>
      <description>thx reply ,&lt;BR /&gt;&lt;BR /&gt;I would like to modify something , if I NOT ONLY compare today's file , I would like to compare ALL file name , no matter what date it is  , as below file , there are different date ( 03Dec , 04Dec &amp;amp; 05Dec ) , I would like to compare all these files , can advise how to do it ? thx&lt;BR /&gt;&lt;BR /&gt;file1.txt;200712031200&lt;BR /&gt;file2.txt;200712041457&lt;BR /&gt;file3.txt;200712041451&lt;BR /&gt;file4.txt;200712051512&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;ps. the file name is unique . &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 14 Dec 2007 15:13:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110976#M313249</guid>
      <dc:creator>ust3</dc:creator>
      <dc:date>2007-12-14T15:13:18Z</dc:date>
    </item>
    <item>
      <title>Re: Check file script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110977#M313250</link>
      <description>&lt;!--!*#--&gt;&amp;gt;I would like to compare ALL file name&lt;BR /&gt;&lt;BR /&gt;(If you want to ignore the date parts completely, ignore lots of this.)&lt;BR /&gt;&lt;BR /&gt;Well first you have to convert from one format until the other so you can just use comm(1) to compare the files.  I would suggest you convert file1.txt;200712031200 to:&lt;BR /&gt;file1.txt Dec 03 12:00&lt;BR /&gt;(This won't work for files older than 6 months, without more work.  It will also fail if you aren't in the American Nerd locale (C).)&lt;BR /&gt;&lt;BR /&gt;Let us assume you have file_for_compare and the output of that "ll /tmp/directory_for_compare" in a file, directory_for_compare.&lt;BR /&gt;&lt;BR /&gt;Should I assume that file1.txt is the same as file1?&lt;BR /&gt;Did you want to compare by just the name or including the date?&lt;BR /&gt;TMP=/var/tmp/dc.$$&lt;BR /&gt;awk -F";" '&lt;BR /&gt;BEGIN {&lt;BR /&gt;mon[1] = "Jan"; mon[2] = "Feb"; mon[3] = "Mar"; mon[4] = "Apr"&lt;BR /&gt;mon[5] = "May"; mon[6] = "Jun"; mon[7] = "Jul"; mon[8] = "Aug"&lt;BR /&gt;mon[9] = "Sep"; mon[10] = "Oct"; mon[11] = "Nov"; mon[12] = "Dec"&lt;BR /&gt;}&lt;BR /&gt;{&lt;BR /&gt;name = $1&lt;BR /&gt;i = index(name, ".txt")&lt;BR /&gt;if (i != 0)&lt;BR /&gt;   name = substr(name, 1, i - 1)&lt;BR /&gt;year = substr($2, 1, 4)&lt;BR /&gt;Mon = substr($2, 5, 2)&lt;BR /&gt;day = substr($2, 7, 2)&lt;BR /&gt;#hr  = substr($2, 9, 2)&lt;BR /&gt;#min = substr($2, 11, 2)&lt;BR /&gt;print name, mon[Mon], day #, hr ":" min&lt;BR /&gt;} ' file_for_compare | sort &amp;gt; $TMP.fff&lt;BR /&gt;&lt;BR /&gt;#-rw-r--r-- 1 user edp 4324 Dec 04 14:57 file1&lt;BR /&gt;awk '&lt;BR /&gt;{&lt;BR /&gt;print $9, $6, $7  #, $8&lt;BR /&gt;} ' directory_for_compare | sort &amp;gt; $TMP.dff&lt;BR /&gt;&lt;BR /&gt;echo "Files not in directory:"&lt;BR /&gt;comm -23 $TMP.fff $TMP.dff&lt;BR /&gt;echo "Files not in control file:"&lt;BR /&gt;comm -13 $TMP.fff $TMP.dff&lt;BR /&gt;&lt;BR /&gt;rm -f $TMP.ffc $TMP.dfc</description>
      <pubDate>Sat, 15 Dec 2007 06:52:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110977#M313250</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-12-15T06:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: Check file script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110978#M313251</link>
      <description>thx reply,&lt;BR /&gt;&lt;BR /&gt;sorry , I have a last requirement .&lt;BR /&gt;&lt;BR /&gt;I sure that the date in the control file MUST be the same date , for example ,  like the below file , all files are the SAME date (3-Dec)  . But it may be not today's date (today is 17-Dec ,  but the date in the control file is  3-Dec) .&lt;BR /&gt;&lt;BR /&gt;file1.txt;200712031200&lt;BR /&gt;file2.txt;200712031457&lt;BR /&gt;file3.txt;200712031451&lt;BR /&gt;file4.txt;200712031512&lt;BR /&gt;"        ;200712031551&lt;BR /&gt;"        ;200712031541 &lt;BR /&gt;"        ;200712031554&lt;BR /&gt;&lt;BR /&gt;so I would like to compare the date ( in the above example , it is 3-Dec ) in the control file with the files that are the same date ( so it is also 3-Dec) in the directory .&lt;BR /&gt;&lt;BR /&gt;ps. the new script can let me not only comparing today's file , but also let me to do the comparsion everyday after I received the control file . &lt;BR /&gt;&lt;BR /&gt;Thx again.</description>
      <pubDate>Mon, 17 Dec 2007 11:23:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110978#M313251</guid>
      <dc:creator>ust3</dc:creator>
      <dc:date>2007-12-17T11:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Check file script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110979#M313252</link>
      <description>&amp;gt;I have a last requirement. Insure that the date in the control file MUST be the same date&lt;BR /&gt;&lt;BR /&gt;My last script does that.  If you want to compare the time you need to remove the "#".&lt;BR /&gt;#hr  = substr($2, 9, 2)&lt;BR /&gt;#min = substr($2, 11, 2)&lt;BR /&gt;print name, mon[Mon], day #, hr ":" min</description>
      <pubDate>Tue, 18 Dec 2007 00:07:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110979#M313252</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-12-18T00:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: Check file script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110980#M313253</link>
      <description>thx reply ,&lt;BR /&gt;&lt;BR /&gt;but when I run the script , it pop the error,&lt;BR /&gt;&lt;BR /&gt;awk: cmd. line:5: fatal: file `directory_for_compare' is a directory .&lt;BR /&gt;&lt;BR /&gt;can advise what is wrong ? thx</description>
      <pubDate>Tue, 18 Dec 2007 01:59:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110980#M313253</guid>
      <dc:creator>ust3</dc:creator>
      <dc:date>2007-12-18T01:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: Check file script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110981#M313254</link>
      <description>&amp;gt;but when I run the script, it pop the error,&lt;BR /&gt;awk: cmd. line:5: fatal: file `directory_for_compare' is a directory .&lt;BR /&gt;&lt;BR /&gt;That was a file that contained the ll(1) output.  Just change those lines to:&lt;BR /&gt;ll directory_for_compare | awk '&lt;BR /&gt;{&lt;BR /&gt;print $9, $6, $7  #, $8&lt;BR /&gt;} ' | sort &amp;gt; $TMP.dff&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Dec 2007 02:46:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110981#M313254</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-12-18T02:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: Check file script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110982#M313255</link>
      <description>&lt;BR /&gt;Hi Dennis,&lt;BR /&gt;&lt;BR /&gt;thx your reply and reply again.&lt;BR /&gt;&lt;BR /&gt;I try the your scirpt , we have two problem.&lt;BR /&gt;&lt;BR /&gt;1. As my request above all files date in control file is 3-Dec , so I only want to check the files with the SAME date (3-Dec also ) in the directory ( because there are many different date files in the directory , I don't want to list all of them ) ;  on the same way , if the file date is 4-Dec in control file , so it compare the files that are 4-Dec in the directory ;&lt;BR /&gt;2. there are many file with various type in the diectroy , if I only want to compre .txt , can advise what can i do ?&lt;BR /&gt;&lt;BR /&gt;thx</description>
      <pubDate>Tue, 18 Dec 2007 04:14:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110982#M313255</guid>
      <dc:creator>ust3</dc:creator>
      <dc:date>2007-12-18T04:14:19Z</dc:date>
    </item>
    <item>
      <title>Re: Check file script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110983#M313256</link>
      <description>&amp;gt;1. I only want to check the files with the SAME date (3-Dec also) in the directory,&lt;BR /&gt;&lt;BR /&gt;That's what the script does.  Compares both the name and the date.  And then does this for ALL entries in the control file and directory.&lt;BR /&gt;&lt;BR /&gt;Otherwise I need a specific example of what you want.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;2. if I only want to compare .txt, can advise what can i do?&lt;BR /&gt;&lt;BR /&gt;It would help if you listed a new control file and directory.  But if you only want to compare .txt files, you use "ll *.txt".</description>
      <pubDate>Tue, 18 Dec 2007 05:45:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110983#M313256</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-12-18T05:45:27Z</dc:date>
    </item>
    <item>
      <title>Re: Check file script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110984#M313257</link>
      <description>thx Dennis and sorry to ask again,&lt;BR /&gt;&lt;BR /&gt;may be I not clearly state my requirement , your script works fine for using the control file to compare the files in directoty , like the above example , the date is 3-Dec , it can list out the files that are in the control file but not in directory , it works fine . Now , my requiremnet is that except this function , I also want to compare the same date (so it is 3-Dec) that the files in the directory but it is not exist in the control file .&lt;BR /&gt;&lt;BR /&gt;the below is the part of the script , it list ALL files in the directory but not only 3-Dec , can advise how to change it ? thx&lt;BR /&gt;&lt;BR /&gt;ll directory_for_compare | awk '&lt;BR /&gt;{&lt;BR /&gt;print $9, $6, $7 #, $8&lt;BR /&gt;} ' | sort &amp;gt; $TMP.dff&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;ps. why use 3-Dec , it is because the date in the control file is 3-Dec.</description>
      <pubDate>Thu, 20 Dec 2007 02:53:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110984#M313257</guid>
      <dc:creator>ust3</dc:creator>
      <dc:date>2007-12-20T02:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: Check file script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110985#M313258</link>
      <description>hi Dennis,&lt;BR /&gt;&lt;BR /&gt;I think the first script provided is perfect  , what need to change is TODAY1 and TODAY2 is not today's date , it should be 3-Dec , can advise how to change it ? thx &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;TMP=/var/tmp/dc.$$&lt;BR /&gt;&lt;BR /&gt;TODAY1=$(date +"%b %d")&lt;BR /&gt;TODAY2=$(date +"%Y%m%d")&lt;BR /&gt;&lt;BR /&gt;echo $TODAY1  # debugging&lt;BR /&gt;echo $TODAY2  # debugging&lt;BR /&gt;&lt;BR /&gt;awk -F";" -v PAT=$TODAY2 '&lt;BR /&gt;$2 ~ PAT { print $1 }' file_for_compare | sort &amp;gt; $TMP.fff&lt;BR /&gt;&lt;BR /&gt;ll /tmp/directory_for_compare | awk -v PAT="$TODAY1" '&lt;BR /&gt;$0 ~ PAT { print $NF }' | sort &amp;gt; $TMP.dff&lt;BR /&gt;&lt;BR /&gt;echo "Files not in directory:"&lt;BR /&gt;comm -23 $TMP.fff $TMP.dff&lt;BR /&gt;echo "Files not in control file:"&lt;BR /&gt;comm -13 $TMP.fff $TMP.dff&lt;BR /&gt;&lt;BR /&gt;rm -f $TMP.fff $TMP.dff</description>
      <pubDate>Thu, 20 Dec 2007 03:05:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110985#M313258</guid>
      <dc:creator>ust3</dc:creator>
      <dc:date>2007-12-20T03:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: Check file script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110986#M313259</link>
      <description>&amp;gt;I want to compare the same date (so it is 3-Dec) that the files in the directory but it is not exist in the control file.&lt;BR /&gt;&lt;BR /&gt;So instead of picking "today" or ALL dates, you want to give a specific date?&lt;BR /&gt;&lt;BR /&gt;If so, that would have to be a parm to the script.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;it list ALL files in the directory but not only 3-Dec, can advise how to change it?&lt;BR /&gt;&lt;BR /&gt;You would need to go back to the first script.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;I think the first script provided is perfect, what need to change is TODAY1 and TODAY2 is not today's date, it should be 3-Dec, can advise how to change it?&lt;BR /&gt;&lt;BR /&gt;Well, you can work hard and provide both formats to your script:&lt;BR /&gt;$ script 20071203 "Dec 03"&lt;BR /&gt;&lt;BR /&gt;Then the script would have:&lt;BR /&gt;TODAY1=$1&lt;BR /&gt;TODAY2=$2&lt;BR /&gt;&lt;BR /&gt;Or you could take the YYYYMMDD format and generate a Dec 03 format:&lt;BR /&gt;TODAY2=$1  # Script arg&lt;BR /&gt;#YYYY=${TODAY2%????}&lt;BR /&gt;DD=${TODAY2#??????}&lt;BR /&gt;MMDD=${TODAY2#????}&lt;BR /&gt;MM=${MMDD%??}&lt;BR /&gt;set -A MON Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec&lt;BR /&gt;TODAY1="${MON[MM-1]} $DD"&lt;BR /&gt;echo $TODAY1&lt;BR /&gt;echo $TODAY2</description>
      <pubDate>Thu, 20 Dec 2007 05:51:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110986#M313259</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-12-20T05:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: Check file script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110987#M313260</link>
      <description>thx dennis ,&lt;BR /&gt;&lt;BR /&gt;back to your first script&lt;BR /&gt;&lt;BR /&gt;====================================================================&lt;BR /&gt;TMP=/var/tmp/dc.$$&lt;BR /&gt;&lt;BR /&gt;TODAY1=$(date +"%b %d")&lt;BR /&gt;TODAY2=$(date +"%Y%m%d")&lt;BR /&gt;&lt;BR /&gt;echo $TODAY1  # debugging&lt;BR /&gt;echo $TODAY2  # debugging&lt;BR /&gt;&lt;BR /&gt;awk -F";" -v PAT=$TODAY2 '&lt;BR /&gt;$2 ~ PAT { print $1 }' file_for_compare | sort &amp;gt; $TMP.fff&lt;BR /&gt;&lt;BR /&gt;ll /tmp/directory_for_compare | awk -v PAT="$TODAY1" '&lt;BR /&gt;$0 ~ PAT { print $NF }' | sort &amp;gt; $TMP.dff&lt;BR /&gt;&lt;BR /&gt;echo "Files not in directory:"&lt;BR /&gt;comm -23 $TMP.fff $TMP.dff&lt;BR /&gt;echo "Files not in control file:"&lt;BR /&gt;comm -13 $TMP.fff $TMP.dff&lt;BR /&gt;&lt;BR /&gt;rm -f $TMP.fff $TMP.dff&lt;BR /&gt;&lt;BR /&gt;========================================================================&lt;BR /&gt;&lt;BR /&gt;it works fine when you post it , I have tried it and get the perfect result , but it is strange that I can't get the result from the part below,&lt;BR /&gt;&lt;BR /&gt;ll /tmp/directory_for_compare | awk -v PAT="$TODAY1" '&lt;BR /&gt;$0 ~ PAT { print $NF }' | sort &amp;gt; $TMP.dff&lt;BR /&gt;&lt;BR /&gt;nothing is generated to $TMP.dff , is it because the year is changed to 2008 now ?  thx for your advise.</description>
      <pubDate>Mon, 07 Jan 2008 08:54:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110987#M313260</guid>
      <dc:creator>ust3</dc:creator>
      <dc:date>2008-01-07T08:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: Check file script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110988#M313261</link>
      <description>&amp;gt;it works fine when you post it&lt;BR /&gt;&lt;BR /&gt;It only works for files with today's date.  You have to look at the other script versions if you want other dates.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;I can't get the result from the part below,&lt;BR /&gt;ll /tmp/directory_for_compare | awk -v PAT="$TODAY1" '...&lt;BR /&gt;&amp;gt;nothing is generated to $TMP.dff, is it because the year is changed to 2008 now?&lt;BR /&gt;&lt;BR /&gt;You need to show some example filenames, (ll of that directory).  2008 shouldn't matter unless the file is over 6 months old.&lt;BR /&gt;&lt;BR /&gt;It would help if you can clearly state what you now want to do and provide some example data.</description>
      <pubDate>Mon, 07 Jan 2008 19:49:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110988#M313261</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-01-07T19:49:01Z</dc:date>
    </item>
    <item>
      <title>Re: Check file script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110989#M313262</link>
      <description>thx Dennis ,&lt;BR /&gt;&lt;BR /&gt;You need to show some example filenames, (ll of that directory). 2008 shouldn't matter unless the file is over 6 months old. &lt;BR /&gt;It would help if you can clearly state what you now want to do and provide some example data. &lt;BR /&gt;&lt;BR /&gt;What I want now is that the requirement of my first question ( please ignore my replies except the first post) , I have tried your script when you post it , it works fine , but now when I run it , the .dff is empty ,  I sure in the directory "directory_for_compare" , there is file which is today's date , &lt;BR /&gt;I found that the output of date +"%b %d" is --&amp;gt; Jan 08 &lt;BR /&gt;the output of ll directory_for_compare is --&amp;gt; Jan 8  , there is difference in output , is it the reason of the problem ? thx &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;-rw-r--r-- 1 user edp 4324 Dec 4 14:57 file1 &lt;BR /&gt;-rw-r--r-- 1 user edp 4324 Dec 4 14:57 file3 &lt;BR /&gt;-rw-r--r-- 1 user edp 4324 Dec 5 18:57 file12  &lt;BR /&gt;-rw-r--r-- 1 user edp 4324 Dec 8 07:42 file12  &lt;BR /&gt;</description>
      <pubDate>Tue, 08 Jan 2008 02:39:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/check-file-script/m-p/4110989#M313262</guid>
      <dc:creator>ust3</dc:creator>
      <dc:date>2008-01-08T02:39:36Z</dc:date>
    </item>
  </channel>
</rss>

