<?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: Scripting help required in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-required/m-p/3220516#M170254</link>
    <description>I think this will do it.&lt;BR /&gt;&lt;BR /&gt;You will need a script file and an awk file.&lt;BR /&gt;&lt;BR /&gt;Put the following into the script file:&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;touch .rfile.today .rfile.yesterday&lt;BR /&gt;rm .rfile.today&lt;BR /&gt;TODAY=`date |awk '{print $2, $3}'`&lt;BR /&gt;for i in `ll |grep "$TODAY"|awk '{print $9}'`&lt;BR /&gt;do&lt;BR /&gt;echo "TOD" $i &amp;gt;&amp;gt; .rfile.today&lt;BR /&gt;done&lt;BR /&gt;cat .rfile.yesterday .rfile.today | sort -b -k2,2 &amp;gt; .rfile.combined&lt;BR /&gt;awk '{print "YES",$2}' .rfile.today &amp;gt; .rfile.yesterday&lt;BR /&gt;awk -f .rfile.awk &amp;lt; .rfile.comb &amp;gt; .runme&lt;BR /&gt;chmod +x .runme&lt;BR /&gt;./.runme&lt;BR /&gt;&lt;BR /&gt;The second file should be called .rfile.awk and should contain:&lt;BR /&gt;&lt;BR /&gt;BEGIN {prev="xyzzy";}&lt;BR /&gt;/^YES / {prev="";dacount=0;}&lt;BR /&gt;/^TOD / {if (dacount&amp;gt;0)&lt;BR /&gt;           {print "rcp ",prev," otherserver:/somedir "};&lt;BR /&gt;         dacount=1; prev=$2;&lt;BR /&gt;        }&lt;BR /&gt;END {if (dacount&amp;gt;0)&lt;BR /&gt;           {print "rcp ",prev," otherserver:/somedir "};}&lt;BR /&gt;&lt;BR /&gt;Obviously you need to replace the "otherserver/somedir", but you get the idea.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;Kent M. Ostby&lt;BR /&gt;</description>
    <pubDate>Tue, 16 Mar 2004 15:09:33 GMT</pubDate>
    <dc:creator>Kent Ostby</dc:creator>
    <dc:date>2004-03-16T15:09:33Z</dc:date>
    <item>
      <title>Scripting help required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-required/m-p/3220510#M170248</link>
      <description>Hi guys,&lt;BR /&gt;         I am looking for a script , that can identify the files, created on a date say for Eg today and rcp them over. And on the next day, if there is a file with the same name it shouldn't rcp that , it should skip that file.&lt;BR /&gt;&lt;BR /&gt;I got answers from some experts , which I am pasting below. But about the skipping the file ie if there is a file with same name, yesterday comparing it with today, how do we do that? I have some thing like one below in place.&lt;BR /&gt;***********************************************&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;TODAY=`date |awk '{print $2, $3}'`&lt;BR /&gt;for i in `ll |grep "$TODAY"|awk '{print $9}'`&lt;BR /&gt;do&lt;BR /&gt;rcp $i otherserver:/somedir&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;***********************************************&lt;BR /&gt;</description>
      <pubDate>Tue, 16 Mar 2004 14:46:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-required/m-p/3220510#M170248</guid>
      <dc:creator>ShivKumar_1</dc:creator>
      <dc:date>2004-03-16T14:46:22Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-required/m-p/3220511#M170249</link>
      <description>Sorry, can't be done no matter what you are told. UNIX has no concept of the creation time of a file; the inode simply doesn't carry that bit of metadata. You only know by accident when a file was created. Change your question and we'll give it a try.&lt;BR /&gt;</description>
      <pubDate>Tue, 16 Mar 2004 14:49:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-required/m-p/3220511#M170249</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-03-16T14:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-required/m-p/3220512#M170250</link>
      <description>Hi,&lt;BR /&gt;    Is there a way of comapring the file names created today and for tomorrow , if the same file name exists then that file has to be left out or do something like a grep -v on that file and rcp the rest over. I am basically looking for some thing to compare.&lt;BR /&gt;</description>
      <pubDate>Tue, 16 Mar 2004 14:58:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-required/m-p/3220512#M170250</guid>
      <dc:creator>ShivKumar_1</dc:creator>
      <dc:date>2004-03-16T14:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-required/m-p/3220513#M170251</link>
      <description>Creation date is not part of a files inode data.&lt;BR /&gt; &lt;BR /&gt;You could write a script that runs at the end of the day that looks for new files and maintains its own list of these files in a text file.&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Tue, 16 Mar 2004 14:59:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-required/m-p/3220513#M170251</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2004-03-16T14:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-required/m-p/3220514#M170252</link>
      <description>By the way, I suggest you take a look at the rdist command. I suspect that it is close to what you want, "out of the box". You might also look at rsync,&lt;BR /&gt;&lt;A href="http://hpux.connect.org.uk/hppd/hpux/Networking/Admin/rsync-2.5.7/" target="_blank"&gt;http://hpux.connect.org.uk/hppd/hpux/Networking/Admin/rsync-2.5.7/&lt;/A&gt;</description>
      <pubDate>Tue, 16 Mar 2004 14:59:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-required/m-p/3220514#M170252</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-03-16T14:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-required/m-p/3220515#M170253</link>
      <description>If these files are in control of some copy process and are copied only once and no other process updates them, then you could assume  that last modify date equals creation date.&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Tue, 16 Mar 2004 15:01:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-required/m-p/3220515#M170253</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2004-03-16T15:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-required/m-p/3220516#M170254</link>
      <description>I think this will do it.&lt;BR /&gt;&lt;BR /&gt;You will need a script file and an awk file.&lt;BR /&gt;&lt;BR /&gt;Put the following into the script file:&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;touch .rfile.today .rfile.yesterday&lt;BR /&gt;rm .rfile.today&lt;BR /&gt;TODAY=`date |awk '{print $2, $3}'`&lt;BR /&gt;for i in `ll |grep "$TODAY"|awk '{print $9}'`&lt;BR /&gt;do&lt;BR /&gt;echo "TOD" $i &amp;gt;&amp;gt; .rfile.today&lt;BR /&gt;done&lt;BR /&gt;cat .rfile.yesterday .rfile.today | sort -b -k2,2 &amp;gt; .rfile.combined&lt;BR /&gt;awk '{print "YES",$2}' .rfile.today &amp;gt; .rfile.yesterday&lt;BR /&gt;awk -f .rfile.awk &amp;lt; .rfile.comb &amp;gt; .runme&lt;BR /&gt;chmod +x .runme&lt;BR /&gt;./.runme&lt;BR /&gt;&lt;BR /&gt;The second file should be called .rfile.awk and should contain:&lt;BR /&gt;&lt;BR /&gt;BEGIN {prev="xyzzy";}&lt;BR /&gt;/^YES / {prev="";dacount=0;}&lt;BR /&gt;/^TOD / {if (dacount&amp;gt;0)&lt;BR /&gt;           {print "rcp ",prev," otherserver:/somedir "};&lt;BR /&gt;         dacount=1; prev=$2;&lt;BR /&gt;        }&lt;BR /&gt;END {if (dacount&amp;gt;0)&lt;BR /&gt;           {print "rcp ",prev," otherserver:/somedir "};}&lt;BR /&gt;&lt;BR /&gt;Obviously you need to replace the "otherserver/somedir", but you get the idea.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;Kent M. Ostby&lt;BR /&gt;</description>
      <pubDate>Tue, 16 Mar 2004 15:09:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-required/m-p/3220516#M170254</guid>
      <dc:creator>Kent Ostby</dc:creator>
      <dc:date>2004-03-16T15:09:33Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-required/m-p/3220517#M170255</link>
      <description>&lt;BR /&gt;Hi,&lt;BR /&gt;Please have a look at rdist commnad.&lt;BR /&gt;&lt;BR /&gt;From rdist man page:&lt;BR /&gt;&lt;BR /&gt;rdist - remote file distribution program&lt;BR /&gt;&lt;BR /&gt;DESCRIPTION&lt;BR /&gt;      rdist facilitates the maintaining of identical copies  of  files  over&lt;BR /&gt;      multiple hosts.  It preserves the owner, group, mode, and modification&lt;BR /&gt;      time of files if possible and can update programs that are executing.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;MB</description>
      <pubDate>Tue, 16 Mar 2004 15:24:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-required/m-p/3220517#M170255</guid>
      <dc:creator>Mihaita Bighiu</dc:creator>
      <dc:date>2004-03-16T15:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-required/m-p/3220518#M170256</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;am I right to assume, that the files get created written to, closed and never touched again, or are they updated a second time?&lt;BR /&gt;If not and all you need are the files modified in the last 24h then you might want to use &lt;BR /&gt;find ./ -type f -mtime -1 -exec rcp "{}" otherserver:/somedir ";"&lt;BR /&gt;&lt;BR /&gt;There is a slight chance to get the creation time. If noone touches the inode with chmod, chown or the like then ls -lc gives you the creation date/time.&lt;BR /&gt;&lt;BR /&gt;greetings&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Tue, 16 Mar 2004 16:54:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help-required/m-p/3220518#M170256</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2004-03-16T16:54:31Z</dc:date>
    </item>
  </channel>
</rss>

