<?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 awk script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script/m-p/3580575#M229769</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Iam having some difficulty with an awk statement. Within a certain dir I want to rename all WUK&amp;lt;8_digits&amp;gt;.dat files TAR&amp;lt;8_digits&amp;gt;.dat, duplicating the WUK files but replacing the TAR with WUK in the filename.&lt;BR /&gt;&lt;BR /&gt;I have tried:&lt;BR /&gt;&lt;BR /&gt;for i in `ll| awk '{ print $4 $15 }' WUK*`&lt;BR /&gt;do&lt;BR /&gt;cp WUK$i TAR$i&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;.....but no joy???&lt;BR /&gt;&lt;BR /&gt;Rgds,&lt;BR /&gt;D.</description>
    <pubDate>Tue, 12 Jul 2005 08:39:44 GMT</pubDate>
    <dc:creator>Duffs</dc:creator>
    <dc:date>2005-07-12T08:39:44Z</dc:date>
    <item>
      <title>awk script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script/m-p/3580575#M229769</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Iam having some difficulty with an awk statement. Within a certain dir I want to rename all WUK&amp;lt;8_digits&amp;gt;.dat files TAR&amp;lt;8_digits&amp;gt;.dat, duplicating the WUK files but replacing the TAR with WUK in the filename.&lt;BR /&gt;&lt;BR /&gt;I have tried:&lt;BR /&gt;&lt;BR /&gt;for i in `ll| awk '{ print $4 $15 }' WUK*`&lt;BR /&gt;do&lt;BR /&gt;cp WUK$i TAR$i&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;.....but no joy???&lt;BR /&gt;&lt;BR /&gt;Rgds,&lt;BR /&gt;D.</description>
      <pubDate>Tue, 12 Jul 2005 08:39:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script/m-p/3580575#M229769</guid>
      <dc:creator>Duffs</dc:creator>
      <dc:date>2005-07-12T08:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: awk script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script/m-p/3580576#M229770</link>
      <description>for i in WUK????????.dat&lt;BR /&gt;do&lt;BR /&gt;cp -p $i `echo $i | sed -e "s/WUK/TAR"`&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 12 Jul 2005 08:57:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script/m-p/3580576#M229770</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2005-07-12T08:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: awk script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script/m-p/3580577#M229771</link>
      <description>Hi John,&lt;BR /&gt;&lt;BR /&gt;Thanks for the speedy response! I am now getting the following output from the debug:&lt;BR /&gt;&lt;BR /&gt;+ sed -e s/WUK/TAR&lt;BR /&gt;+ echo WUK????????.dat&lt;BR /&gt;sed: Function s/WUK/TAR cannot be parsed.&lt;BR /&gt;+ cp -p WUK????????.dat&lt;BR /&gt;Usage:  cp [-f|-i] [-p] [-S] [-e warn|force|ignore] source_file target_file&lt;BR /&gt;        cp [-f|-i] [-p] [-S] [-e warn|force|ignore] source_file ... target_direc&lt;BR /&gt;tory&lt;BR /&gt;        cp [-f|-i] [-p] [-S] -R|-r [-e warn|force|ignore] source_directory ... t&lt;BR /&gt;arget_directory&lt;BR /&gt;&lt;BR /&gt;Rgds,&lt;BR /&gt;D</description>
      <pubDate>Tue, 12 Jul 2005 09:06:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script/m-p/3580577#M229771</guid>
      <dc:creator>Duffs</dc:creator>
      <dc:date>2005-07-12T09:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: awk script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script/m-p/3580578#M229772</link>
      <description>I've run across that before ... lemme play with it a bit over here...</description>
      <pubDate>Tue, 12 Jul 2005 09:13:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script/m-p/3580578#M229772</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2005-07-12T09:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: awk script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script/m-p/3580579#M229773</link>
      <description>Well - I'm used to using -e and putting quotes (either for actual reasons that it works - or just a brain fart - I dunno)  ... anyway this works over here in a test set I made that matches your file names...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;for i in WUK????????.dat&lt;BR /&gt;do&lt;BR /&gt;cp -p $i `echo $i | sed s/WUK/TAR`&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Run ...&lt;BR /&gt;&lt;BR /&gt;testhost:/tmp/junk/ for i in WUK????????.dat; do cp -p $i `echo $i | sed s/WUK/TAR/`; done&lt;BR /&gt;testhost:/tmp/junk/ ls -al &lt;BR /&gt;total 0&lt;BR /&gt;-rw-r--r--   1 root       sys              0 Jul 12 11:12 TAR12335678.dat&lt;BR /&gt;-rw-r--r--   1 root       sys              0 Jul 12 11:11 TAR12345678.dat&lt;BR /&gt;-rw-r--r--   1 root       sys              0 Jul 12 11:12 WUK12335678.dat&lt;BR /&gt;-rw-r--r--   1 root       sys              0 Jul 12 11:11 WUK12345678.dat&lt;BR /&gt;</description>
      <pubDate>Tue, 12 Jul 2005 09:19:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script/m-p/3580579#M229773</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2005-07-12T09:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: awk script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script/m-p/3580580#M229774</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;You can do it without using awk.  Try this:&lt;BR /&gt;&lt;BR /&gt;for i WUK*&lt;BR /&gt;do&lt;BR /&gt;  n=${i##WUK}&lt;BR /&gt;  cp $i TAR${n}&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;</description>
      <pubDate>Tue, 12 Jul 2005 09:26:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script/m-p/3580580#M229774</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2005-07-12T09:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: awk script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script/m-p/3580581#M229775</link>
      <description>Cool JP, I knew I had read some time back that I could do something like this in the shell itself, but couldn't recall where.  I've been mentally shaming myself each time I used awk  to do this (when you have a hammer everything looks like a nail) - remembering that I'd read somewhere how to do it directly in the shell.</description>
      <pubDate>Tue, 12 Jul 2005 09:30:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script/m-p/3580581#M229775</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2005-07-12T09:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: awk script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script/m-p/3580582#M229776</link>
      <description>Thanks a million lads!&lt;BR /&gt;Kind Rgds,&lt;BR /&gt;D</description>
      <pubDate>Tue, 12 Jul 2005 09:37:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script/m-p/3580582#M229776</guid>
      <dc:creator>Duffs</dc:creator>
      <dc:date>2005-07-12T09:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: awk script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script/m-p/3580583#M229777</link>
      <description>(No more points) ... but going further with the information provided by JP (just for fun):&lt;BR /&gt;&lt;BR /&gt;This is pretty small and does the job.&lt;BR /&gt;&lt;BR /&gt;for i in WUK*; do cp $i ${i/#WUK/TAR}; done</description>
      <pubDate>Tue, 12 Jul 2005 09:51:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script/m-p/3580583#M229777</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2005-07-12T09:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: awk script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script/m-p/3580584#M229778</link>
      <description>Dermot,&lt;BR /&gt;&lt;BR /&gt;You can use this one-liner awk program.&lt;BR /&gt;&lt;BR /&gt;# ls -1 WUK[0-9]*.dat | awk -F"WUK" '{system("cp "$0" TAR"$2)}'&lt;BR /&gt;&lt;BR /&gt;cheers!&lt;BR /&gt;</description>
      <pubDate>Tue, 12 Jul 2005 14:00:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script/m-p/3580584#M229778</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2005-07-12T14:00:20Z</dc:date>
    </item>
  </channel>
</rss>

