<?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: find and cp -p in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136847#M154264</link>
    <description>I would go for the sed solution. And since you are not interested in filenames, I would do it like this:&lt;BR /&gt;&lt;BR /&gt;cat file* | grep BGM | sed 's|BGM+12E::9+\(.*.\)+6\'DTM+137.*|\1' &amp;gt;&amp;gt; output&lt;BR /&gt;</description>
    <pubDate>Fri, 05 Dec 2003 04:26:16 GMT</pubDate>
    <dc:creator>Elmar P. Kolkman</dc:creator>
    <dc:date>2003-12-05T04:26:16Z</dc:date>
    <item>
      <title>find and cp -p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136838#M154255</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;I need to write a shell script to find files created in a /backup folder starting on 0000 hrs until current.&lt;BR /&gt;&lt;BR /&gt;I also would like to copy the result into a different folder ie /dump&lt;BR /&gt;&lt;BR /&gt;The script so far that I have is as below:&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;WorkingDir=/export/home/b2b_supp/aperak&lt;BR /&gt;Date=`date +%m%d`&lt;BR /&gt;DateN=$Date&lt;BR /&gt;echo "$DateN""0000" &amp;gt; $WorkingDir/mydate.txt&lt;BR /&gt;DateW=`cat $WorkingDir/mydate.txt`&lt;BR /&gt;touch -m $DateW $WorkingDir/datefile.txt&lt;BR /&gt;find /opt/cyclone/data/TOPSMAL01/backup -newer $WorkingDir/datefile.txt -name *out &amp;gt;&amp;gt; $WorkingDir/todayfiles_msia.lis&lt;BR /&gt;&lt;BR /&gt;How do I cp -p the files found into another folder?&lt;BR /&gt;&lt;BR /&gt;Thanks in advace&lt;BR /&gt;&lt;BR /&gt;Zul</description>
      <pubDate>Fri, 05 Dec 2003 01:39:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136838#M154255</guid>
      <dc:creator>Zulfikri</dc:creator>
      <dc:date>2003-12-05T01:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: find and cp -p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136839#M154256</link>
      <description>Your construction with the DATE vars seems a bit compicated. Why not just:&lt;BR /&gt;&lt;BR /&gt;touch -mt ${DATE}0000 $WorkingDir/datefile.txt&lt;BR /&gt;&lt;BR /&gt;As for the cp -p, you could do it like this:&lt;BR /&gt;find /opt/cyclone/data/TOPSMAL01/backup -newer $WorkingDir/datefile.txt -name '*out' -exec cp -p {} &lt;NEW location=""&gt; \;&lt;BR /&gt;&lt;BR /&gt;Or you could use the lis file you create and use cpio or pax to copy the files.&lt;BR /&gt;&lt;BR /&gt;A problem you might encounter, depending on where you like the files to be copied too, is the path the files have. Since you do the find with the absolute path, the complete directory will be copied. A better way might be to do a change directory to your backup directory and do a find from '.' .&lt;/NEW&gt;</description>
      <pubDate>Fri, 05 Dec 2003 02:13:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136839#M154256</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2003-12-05T02:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: find and cp -p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136840#M154257</link>
      <description>Hi,&lt;BR /&gt;pipe the output to cpio&lt;BR /&gt;&lt;BR /&gt;find ...... |cpio -pdvmux &lt;NEW_FOLDER&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/NEW_FOLDER&gt;</description>
      <pubDate>Fri, 05 Dec 2003 02:14:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136840#M154257</guid>
      <dc:creator>Leif Halvarsson_2</dc:creator>
      <dc:date>2003-12-05T02:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: find and cp -p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136841#M154258</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;Thanks for the kind input. Now I need to do some cleanup of the files that I copied into the /dump folder.&lt;BR /&gt;&lt;BR /&gt;The file content would look like below as single line:-&lt;BR /&gt;&lt;BR /&gt;UNA:+.? 'UNB+UNOA:3+9554000001105:14+3020476101404:14+031205:1313+23054++++0'UNH+2305400001+APERAK:D:96A:UN:EAN002'BGM+12E::9+33596+6'DTM+137:20031204:203'RFF+ON:142260085N'UNT+5+2305400001'UNZ+1+23054'&lt;BR /&gt;&lt;BR /&gt;I only interested in the value after BGM+12E::9+ and before +6'DTM+137 which is 3359. I know that sed can do this but I could not get the correct command/syntax....&lt;BR /&gt;&lt;BR /&gt;Again...many thanks in advance&lt;BR /&gt;&lt;BR /&gt;Zul</description>
      <pubDate>Fri, 05 Dec 2003 03:43:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136841#M154258</guid>
      <dc:creator>Zulfikri</dc:creator>
      <dc:date>2003-12-05T03:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: find and cp -p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136842#M154259</link>
      <description>How about&lt;BR /&gt; &lt;BR /&gt;expr "`cat myfike`" : ".*BGM+12E::9+\(.*\)+6'DTM+137.*"</description>
      <pubDate>Fri, 05 Dec 2003 03:59:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136842#M154259</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-12-05T03:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: find and cp -p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136843#M154260</link>
      <description>obviously "myfyke" was supposed to say "myfile" and is the name of the file you have your data in :)</description>
      <pubDate>Fri, 05 Dec 2003 04:00:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136843#M154260</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-12-05T04:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: find and cp -p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136844#M154261</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;grep BGM file | sed 's;.*BGM+[^+]*+\([^+]*\)+.*;\1;'&lt;BR /&gt;&lt;BR /&gt;But the returned value is 33596 ...&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Fri, 05 Dec 2003 04:02:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136844#M154261</guid>
      <dc:creator>Jean-Louis Phelix</dc:creator>
      <dc:date>2003-12-05T04:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: find and cp -p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136845#M154262</link>
      <description>Hi Mike,&lt;BR /&gt;&lt;BR /&gt;I got the output using expr "`cat a51290TOPSMAL01out`" : ".*BGM+12E::9+\(.*\)+6'DTM+137.*"&lt;BR /&gt;&lt;BR /&gt;I have about 500 files of a*out in that folder, so to run thru all files, what should I do in a better way?&lt;BR /&gt;&lt;BR /&gt;Usually what I'do would be:-&lt;BR /&gt;&lt;BR /&gt;#! /bin/ksh&lt;BR /&gt;ls file* &amp;gt;&amp;gt; file.lis&lt;BR /&gt;exec 3&amp;lt; file.lis&lt;BR /&gt;&lt;BR /&gt;while read line &amp;lt;&amp;amp; 3&lt;BR /&gt;do&lt;BR /&gt;expr "`cat $line`" : ".*BGM+12E::9+\(.*\)+6'DTM+137.*" &amp;gt;&amp;gt; output.txt&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Is there any better way? Sorry...I'm a newbie but like to learn....;-)&lt;BR /&gt;&lt;BR /&gt;thanks again&lt;BR /&gt;&lt;BR /&gt;Zul</description>
      <pubDate>Fri, 05 Dec 2003 04:16:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136845#M154262</guid>
      <dc:creator>Zulfikri</dc:creator>
      <dc:date>2003-12-05T04:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: find and cp -p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136846#M154263</link>
      <description>You can simply use :&lt;BR /&gt;&lt;BR /&gt;grep BGM file* | sed 's;.*BGM+[^+]*+\([^+]*\)+.*;\1;'&lt;BR /&gt;&lt;BR /&gt;Regards.</description>
      <pubDate>Fri, 05 Dec 2003 04:19:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136846#M154263</guid>
      <dc:creator>Jean-Louis Phelix</dc:creator>
      <dc:date>2003-12-05T04:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: find and cp -p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136847#M154264</link>
      <description>I would go for the sed solution. And since you are not interested in filenames, I would do it like this:&lt;BR /&gt;&lt;BR /&gt;cat file* | grep BGM | sed 's|BGM+12E::9+\(.*.\)+6\'DTM+137.*|\1' &amp;gt;&amp;gt; output&lt;BR /&gt;</description>
      <pubDate>Fri, 05 Dec 2003 04:26:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136847#M154264</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2003-12-05T04:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: find and cp -p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136848#M154265</link>
      <description>#! /bin/ksh&lt;BR /&gt;&lt;BR /&gt;for i in a*out&lt;BR /&gt;do&lt;BR /&gt; expr "`cat $i`" : ".*BGM+12E::9+\(.*\)+6'DTM+137.*" &amp;gt;&amp;gt; output.txt&lt;BR /&gt;done&lt;BR /&gt; &lt;BR /&gt;or try Jean-Louis' option (above)</description>
      <pubDate>Fri, 05 Dec 2003 04:30:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136848#M154265</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-12-05T04:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: find and cp -p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136849#M154266</link>
      <description>Hi ppl,&lt;BR /&gt;&lt;BR /&gt;Many many thanks for the help. (I'm almost there!!..yippee)&lt;BR /&gt;Now I got a new request from the pointy head boss to find all files created from ie&lt;BR /&gt;12/04/03 0000hrs to 12/05/03 0100hrs, itead of 12/04/03 0000hrs to 12/04/03 2359&lt;BR /&gt;&lt;BR /&gt;I cant think a way to do that except have to create 2 scripts.&lt;BR /&gt;&lt;BR /&gt;May I ask for some suggestions.&lt;BR /&gt;&lt;BR /&gt;best regards,&lt;BR /&gt;&lt;BR /&gt;Zul</description>
      <pubDate>Fri, 05 Dec 2003 05:57:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136849#M154266</guid>
      <dc:creator>Zulfikri</dc:creator>
      <dc:date>2003-12-05T05:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: find and cp -p</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136850#M154267</link>
      <description>Hi,&lt;BR /&gt;if you create a file, e.g. file_begin with a last mod. time of 12/04/03 00:00 and the file file_end with a last mod. time of 12/05/03 01:00, this should work:&lt;BR /&gt; &lt;BR /&gt;# find &lt;START_DIR&gt; -type f  \( -newer file_begin \) -a   \( ! -newer file_end \) -exec ls -ltr {} \;&lt;BR /&gt; &lt;BR /&gt;regards,&lt;BR /&gt;John K.&lt;BR /&gt;&lt;BR /&gt;&lt;/START_DIR&gt;</description>
      <pubDate>Fri, 05 Dec 2003 06:14:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-and-cp-p/m-p/3136850#M154267</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2003-12-05T06:14:24Z</dc:date>
    </item>
  </channel>
</rss>

