<?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: Renaming Multiple files in one command in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/renaming-multiple-files-in-one-command/m-p/3555326#M225675</link>
    <description>hi amit,&lt;BR /&gt;&lt;BR /&gt;try this ...&lt;BR /&gt;goto the directory where you want to change ....execute this ....&lt;BR /&gt;&lt;BR /&gt;for i in *.arc&lt;BR /&gt;do&lt;BR /&gt;nfile=${i%.arc}&lt;BR /&gt;mv $i $nfile&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;I have checked and it works...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;regds&lt;BR /&gt;Venkatesan.&lt;BR /&gt;</description>
    <pubDate>Wed, 01 Jun 2005 00:18:01 GMT</pubDate>
    <dc:creator>Venkatesan_5</dc:creator>
    <dc:date>2005-06-01T00:18:01Z</dc:date>
    <item>
      <title>Renaming Multiple files in one command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/renaming-multiple-files-in-one-command/m-p/3555323#M225672</link>
      <description>Hi,&lt;BR /&gt;I have more that 500 file with naming convention&lt;BR /&gt;myfile.txt.20050117042157484.arc&lt;BR /&gt;and I want to rename them to&lt;BR /&gt;myfile.txt.20050117042157484&lt;BR /&gt;&lt;BR /&gt;Want to remove ".arc" extension from all of them.&lt;BR /&gt;&lt;BR /&gt;will this command do&lt;BR /&gt;ls -1 *.arc | awk '{print "mv "$1.arc" "$1" "}'&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Amit.&lt;BR /&gt;</description>
      <pubDate>Tue, 31 May 2005 21:55:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/renaming-multiple-files-in-one-command/m-p/3555323#M225672</guid>
      <dc:creator>Amit Dixit_2</dc:creator>
      <dc:date>2005-05-31T21:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming Multiple files in one command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/renaming-multiple-files-in-one-command/m-p/3555324#M225673</link>
      <description>Hi Amit,&lt;BR /&gt;&lt;BR /&gt;Run this script on the directory of the file.&lt;BR /&gt;&lt;BR /&gt;for i in `ll|grep txt|awk '{print $9}'`&lt;BR /&gt;do&lt;BR /&gt;  nfile=${i%.arc}&lt;BR /&gt;  mv $i $nfile&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;I checked it, it work. Modify to suit your needs.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Paul</description>
      <pubDate>Tue, 31 May 2005 22:13:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/renaming-multiple-files-in-one-command/m-p/3555324#M225673</guid>
      <dc:creator>Paul_481</dc:creator>
      <dc:date>2005-05-31T22:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming Multiple files in one command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/renaming-multiple-files-in-one-command/m-p/3555325#M225674</link>
      <description>You are not the first one to ask this question.&lt;BR /&gt;For example look for rename in a Unix faq:&lt;BR /&gt;&lt;A href="http://www.faqs.org/faqs/unix-faq/faq/part2/index.html" target="_blank"&gt;http://www.faqs.org/faqs/unix-faq/faq/part2/index.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The following examples, tailored to your problem work for me: &lt;BR /&gt;&lt;BR /&gt;piping ls selection into perl:&lt;BR /&gt;&lt;BR /&gt;$  ls my*arc | perl -ne 'chop; $old=$_; s/\.arc//; rename $old,$_'&lt;BR /&gt;&lt;BR /&gt;or just perl glob function:&lt;BR /&gt;&lt;BR /&gt; perl -e 'while (&lt;MY&gt;){$old=$_; s/\.arc//;rename $old,$_}'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;btw... Paul's example can be simplified a lot replacing:&lt;BR /&gt;`ll|grep txt|awk '{print $9}'`&lt;BR /&gt;with:&lt;BR /&gt;`ls *txt*`&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;/MY&gt;</description>
      <pubDate>Wed, 01 Jun 2005 00:12:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/renaming-multiple-files-in-one-command/m-p/3555325#M225674</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2005-06-01T00:12:41Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming Multiple files in one command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/renaming-multiple-files-in-one-command/m-p/3555326#M225675</link>
      <description>hi amit,&lt;BR /&gt;&lt;BR /&gt;try this ...&lt;BR /&gt;goto the directory where you want to change ....execute this ....&lt;BR /&gt;&lt;BR /&gt;for i in *.arc&lt;BR /&gt;do&lt;BR /&gt;nfile=${i%.arc}&lt;BR /&gt;mv $i $nfile&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;I have checked and it works...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;regds&lt;BR /&gt;Venkatesan.&lt;BR /&gt;</description>
      <pubDate>Wed, 01 Jun 2005 00:18:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/renaming-multiple-files-in-one-command/m-p/3555326#M225675</guid>
      <dc:creator>Venkatesan_5</dc:creator>
      <dc:date>2005-06-01T00:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming Multiple files in one command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/renaming-multiple-files-in-one-command/m-p/3555327#M225676</link>
      <description>You can do it as,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;for file in `ls *.arc`&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;  mv $file $(echo $file | cut -d"." -f1-3)&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Wed, 01 Jun 2005 00:18:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/renaming-multiple-files-in-one-command/m-p/3555327#M225676</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-06-01T00:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming Multiple files in one command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/renaming-multiple-files-in-one-command/m-p/3555328#M225677</link>
      <description>You can use your method also as,&lt;BR /&gt;&lt;BR /&gt;ls -1 *.arc | awk '{ split($1,a,"."); print "mv "$1" "a[1]"."a[2]"."a[3] }' | sh&lt;BR /&gt;&lt;BR /&gt;| sh is used to make action.&lt;BR /&gt;&lt;BR /&gt;It will do it.</description>
      <pubDate>Wed, 01 Jun 2005 00:19:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/renaming-multiple-files-in-one-command/m-p/3555328#M225677</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-06-01T00:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming Multiple files in one command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/renaming-multiple-files-in-one-command/m-p/3555329#M225678</link>
      <description>I already see some replies, none of which uses the `basename` command, which has an option to remove the extention.&lt;BR /&gt;&lt;BR /&gt;for f in *.arc&lt;BR /&gt;do&lt;BR /&gt;  mv $f `basename $f .arc`&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Or with find, to traverse a filesystem (this is a one-liner)&lt;BR /&gt;&lt;BR /&gt;find . -name '*.arc' -exec 'mv {} `dirname {}`/`basename {} .arc` ;'&lt;BR /&gt;</description>
      <pubDate>Thu, 02 Jun 2005 02:31:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/renaming-multiple-files-in-one-command/m-p/3555329#M225678</guid>
      <dc:creator>C. Beerse_1</dc:creator>
      <dc:date>2005-06-02T02:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming Multiple files in one command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/renaming-multiple-files-in-one-command/m-p/3555330#M225679</link>
      <description>amit,&lt;BR /&gt;&lt;BR /&gt;the following command will do what you're looking for...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;# ls -1 *.arc | awk -F".arc" '{system("mv "$0" "$1)}'</description>
      <pubDate>Thu, 02 Jun 2005 03:51:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/renaming-multiple-files-in-one-command/m-p/3555330#M225679</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2005-06-02T03:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming Multiple files in one command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/renaming-multiple-files-in-one-command/m-p/3555331#M225680</link>
      <description>amit,&lt;BR /&gt;&lt;BR /&gt;try this ,&lt;BR /&gt;&lt;BR /&gt;ls -1 *arc |sed 's/\(.*\)\(\.arc\)/mv \1\2 \1'|sh -v&lt;BR /&gt;&lt;BR /&gt;regards</description>
      <pubDate>Thu, 02 Jun 2005 06:51:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/renaming-multiple-files-in-one-command/m-p/3555331#M225680</guid>
      <dc:creator>Aupee Jean-Francois</dc:creator>
      <dc:date>2005-06-02T06:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming Multiple files in one command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/renaming-multiple-files-in-one-command/m-p/3555332#M225681</link>
      <description>Why to complicate sed&lt;BR /&gt;&lt;BR /&gt;sed -e 's/\.arc$//g'</description>
      <pubDate>Thu, 02 Jun 2005 07:10:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/renaming-multiple-files-in-one-command/m-p/3555332#M225681</guid>
      <dc:creator>Vibhor Kumar Agarwal</dc:creator>
      <dc:date>2005-06-02T07:10:58Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming Multiple files in one command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/renaming-multiple-files-in-one-command/m-p/3555333#M225682</link>
      <description>Lets generalise it a bit:&lt;BR /&gt;&lt;BR /&gt;The following will work for any extension&lt;BR /&gt;&lt;BR /&gt;sed -e 's/\..*$//g'</description>
      <pubDate>Thu, 02 Jun 2005 08:18:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/renaming-multiple-files-in-one-command/m-p/3555333#M225682</guid>
      <dc:creator>Vibhor Kumar Agarwal</dc:creator>
      <dc:date>2005-06-02T08:18:31Z</dc:date>
    </item>
  </channel>
</rss>

