<?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: shell script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765686#M73587</link>
    <description>Hi,&lt;BR /&gt;If there is a single file *.r this will work&lt;BR /&gt;#mv *.r oo.i&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;U.SivaKumar</description>
    <pubDate>Wed, 17 Jul 2002 08:30:27 GMT</pubDate>
    <dc:creator>U.SivaKumar_2</dc:creator>
    <dc:date>2002-07-17T08:30:27Z</dc:date>
    <item>
      <title>shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765679#M73580</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;-rw-r--r-- 1 apptst42   dba  1204 Jul 17 16:51 oo.r (file name)&lt;BR /&gt;&lt;BR /&gt;I want to rename the file oo.r to oo.i. Don't &lt;BR /&gt;use copy and delete.&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;&lt;BR /&gt;ravi</description>
      <pubDate>Wed, 17 Jul 2002 08:14:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765679#M73580</guid>
      <dc:creator>skravi17</dc:creator>
      <dc:date>2002-07-17T08:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765680#M73581</link>
      <description>hi, &lt;BR /&gt;use mv &lt;OLD&gt; &lt;NEW&gt; &lt;BR /&gt;&lt;BR /&gt;hth &lt;BR /&gt;&lt;BR /&gt;Patrick&lt;/NEW&gt;&lt;/OLD&gt;</description>
      <pubDate>Wed, 17 Jul 2002 08:17:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765680#M73581</guid>
      <dc:creator>Patrick Preuss</dc:creator>
      <dc:date>2002-07-17T08:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765681#M73582</link>
      <description>Hi Ravi,&lt;BR /&gt;&lt;BR /&gt;Do the following&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;mv oo.r oo.i&lt;BR /&gt;&lt;BR /&gt;-Sukant</description>
      <pubDate>Wed, 17 Jul 2002 08:17:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765681#M73582</guid>
      <dc:creator>Sukant Naik</dc:creator>
      <dc:date>2002-07-17T08:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765682#M73583</link>
      <description>hi&lt;BR /&gt;#mv oo.r oo.i&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;U.SivaKumar</description>
      <pubDate>Wed, 17 Jul 2002 08:17:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765682#M73583</guid>
      <dc:creator>U.SivaKumar_2</dc:creator>
      <dc:date>2002-07-17T08:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765683#M73584</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;Just use mv&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; mv(1)                                                                 mv(1)&lt;BR /&gt;&lt;BR /&gt; NAME&lt;BR /&gt;      mv - move or rename files and directories&lt;BR /&gt;&lt;BR /&gt; SYNOPSIS&lt;BR /&gt;      mv [-f|-i] [-e extarg] file1 new-file&lt;BR /&gt;&lt;BR /&gt;      mv [-f|-i] [-e extarg] file1 [file2 ...] dest-directory&lt;BR /&gt;&lt;BR /&gt;      mv [-f|-i] [-e extarg] directory1 [directory2 ...] dest-directory&lt;BR /&gt;&lt;BR /&gt; DESCRIPTION&lt;BR /&gt;      The mv command moves:&lt;BR /&gt;&lt;BR /&gt;           +  One file (file1) to a new or existing file (new-file).&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;              Steve Steel</description>
      <pubDate>Wed, 17 Jul 2002 08:18:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765683#M73584</guid>
      <dc:creator>Steve Steel</dc:creator>
      <dc:date>2002-07-17T08:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765684#M73585</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;i want to move the file oo.i to oo.r(example), actually&lt;BR /&gt;i don't know the file name but ending with .i&lt;BR /&gt;so how i will move the file *.i to *.r&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;&lt;BR /&gt;ravi</description>
      <pubDate>Wed, 17 Jul 2002 08:23:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765684#M73585</guid>
      <dc:creator>skravi17</dc:creator>
      <dc:date>2002-07-17T08:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765685#M73586</link>
      <description>are you looking for script to move the file, here u find the script&lt;BR /&gt;for i in `ls`&lt;BR /&gt;do&lt;BR /&gt;echo "==== $i ===="&lt;BR /&gt;/usr/bin/mv $i oo.i&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Jul 2002 08:29:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765685#M73586</guid>
      <dc:creator>kish_1</dc:creator>
      <dc:date>2002-07-17T08:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765686#M73587</link>
      <description>Hi,&lt;BR /&gt;If there is a single file *.r this will work&lt;BR /&gt;#mv *.r oo.i&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;U.SivaKumar</description>
      <pubDate>Wed, 17 Jul 2002 08:30:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765686#M73587</guid>
      <dc:creator>U.SivaKumar_2</dc:creator>
      <dc:date>2002-07-17T08:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765687#M73588</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;#!/sbin/sh&lt;BR /&gt;&lt;BR /&gt;old=i&lt;BR /&gt;new=j&lt;BR /&gt;&lt;BR /&gt;for file in *.$old&lt;BR /&gt;do&lt;BR /&gt;  mv $file `echo $file | cut -d\. -f1`.$new&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Hope this helps. Regards.&lt;BR /&gt;&lt;BR /&gt;Steven Sim Kok Leong</description>
      <pubDate>Wed, 17 Jul 2002 08:32:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765687#M73588</guid>
      <dc:creator>Steven Sim Kok Leong</dc:creator>
      <dc:date>2002-07-17T08:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765688#M73589</link>
      <description>Hi steven&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks lot, solved my problem.&lt;BR /&gt;i modified your script.&lt;BR /&gt;&lt;BR /&gt;old=r&lt;BR /&gt;new=i&lt;BR /&gt;&lt;BR /&gt;for file in `ls *.$old`&lt;BR /&gt;do&lt;BR /&gt;mv $file `echo $file | cut -d\. -f1`.$new&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;&lt;BR /&gt;ravi&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Jul 2002 08:42:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765688#M73589</guid>
      <dc:creator>skravi17</dc:creator>
      <dc:date>2002-07-17T08:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765689#M73590</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;sorry,&lt;BR /&gt;&lt;BR /&gt;Actually my requirment is i have 2 files&lt;BR /&gt;&lt;BR /&gt;-rw-r--r--   1 oratst42   dba              0 Jul 17 17:41 AS8@F2.20717.1741.I&lt;BR /&gt;-rw-r--r--   1 oratst42   dba            870 Jul 17 17:50 AS8@10.20717.1750.I&lt;BR /&gt;&lt;BR /&gt;but i ran that script i am getting output&lt;BR /&gt;like this&lt;BR /&gt;&lt;BR /&gt;-rw-r--r--   1 apptst42   dba            870 Jul 17 17:51 AS8@10.M&lt;BR /&gt;&lt;BR /&gt;but i want like this &lt;BR /&gt;&lt;BR /&gt;AS8@10.20717.1750.I to AS8@10.20717.1750.M&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;&lt;BR /&gt;ravi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Jul 2002 08:51:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765689#M73590</guid>
      <dc:creator>skravi17</dc:creator>
      <dc:date>2002-07-17T08:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765690#M73591</link>
      <description>Hi, &lt;BR /&gt;&lt;BR /&gt;#!/sbin/sh &lt;BR /&gt;&lt;BR /&gt;old=i &lt;BR /&gt;new=j &lt;BR /&gt;&lt;BR /&gt;for file in *.$old &lt;BR /&gt;do &lt;BR /&gt;mv $file `echo $file | awk -F\. '{print $1"."$2"."$3"."}'`.$new &lt;BR /&gt;done &lt;BR /&gt;&lt;BR /&gt;Hope this helps. Regards. &lt;BR /&gt;&lt;BR /&gt;Steven Sim Kok Leong</description>
      <pubDate>Wed, 17 Jul 2002 08:59:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765690#M73591</guid>
      <dc:creator>Steven Sim Kok Leong</dc:creator>
      <dc:date>2002-07-17T08:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765691#M73592</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;A better way:&lt;BR /&gt;&lt;BR /&gt;Hi, &lt;BR /&gt;&lt;BR /&gt;#!/sbin/sh &lt;BR /&gt;&lt;BR /&gt;old=I &lt;BR /&gt;new=M &lt;BR /&gt;&lt;BR /&gt;for file in *.$old &lt;BR /&gt;do &lt;BR /&gt;mv $file `echo $file | sed -e 's/.$old$/.$new/g'&lt;BR /&gt;done &lt;BR /&gt;&lt;BR /&gt;Hope this helps. Regards. &lt;BR /&gt;&lt;BR /&gt;Steven Sim Kok Leong</description>
      <pubDate>Wed, 17 Jul 2002 09:02:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765691#M73592</guid>
      <dc:creator>Steven Sim Kok Leong</dc:creator>
      <dc:date>2002-07-17T09:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765692#M73593</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I missed out a grave accent (`) after the sed:&lt;BR /&gt;&lt;BR /&gt;#!/sbin/sh &lt;BR /&gt;&lt;BR /&gt;old=I &lt;BR /&gt;new=M &lt;BR /&gt;&lt;BR /&gt;for file in *.$old &lt;BR /&gt;do &lt;BR /&gt;mv $file `echo $file | sed -e 's/.$old$/.$new/g'` &lt;BR /&gt;done &lt;BR /&gt;&lt;BR /&gt;With pattern matching (e.g. using sed), you do not need to worry about the number of dots (.) you have as part of your filename.&lt;BR /&gt;&lt;BR /&gt;Hope this helps. Regards. &lt;BR /&gt;&lt;BR /&gt;Steven Sim Kok Leong</description>
      <pubDate>Wed, 17 Jul 2002 09:04:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765692#M73593</guid>
      <dc:creator>Steven Sim Kok Leong</dc:creator>
      <dc:date>2002-07-17T09:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765693#M73594</link>
      <description>Hi steven&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Again Thanks lot. All your scripts works fine&lt;BR /&gt;thanks. but I did this way.&lt;BR /&gt;&lt;BR /&gt;old=I&lt;BR /&gt;new=M&lt;BR /&gt;&lt;BR /&gt;for file in `ls *.$old`&lt;BR /&gt;do&lt;BR /&gt;mv $file `echo $file | cut -d\. -f1,2,3`.$new&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;&lt;BR /&gt;ravi</description>
      <pubDate>Wed, 17 Jul 2002 09:07:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765693#M73594</guid>
      <dc:creator>skravi17</dc:creator>
      <dc:date>2002-07-17T09:07:41Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765694#M73595</link>
      <description>hi&lt;BR /&gt;Try the basename command for this&lt;BR /&gt;&lt;BR /&gt;for file in *.I&lt;BR /&gt;do&lt;BR /&gt;mv $file `basename $file .I`.M&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Jul 2002 10:30:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765694#M73595</guid>
      <dc:creator>Leif Halvarsson_2</dc:creator>
      <dc:date>2002-07-17T10:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765695#M73596</link>
      <description>Hi Ravi,&lt;BR /&gt;&lt;BR /&gt;try the pattern-matching operators.&lt;BR /&gt;&lt;BR /&gt;old=I&lt;BR /&gt;new=M&lt;BR /&gt;&lt;BR /&gt;for file in `ls *.$old`&lt;BR /&gt;do&lt;BR /&gt;   newfile=${file%.$old}.$new&lt;BR /&gt;   mv $file $newfile&lt;BR /&gt;done</description>
      <pubDate>Wed, 17 Jul 2002 11:31:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765695#M73596</guid>
      <dc:creator>perez Ilan</dc:creator>
      <dc:date>2002-07-17T11:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765696#M73597</link>
      <description>ksh has a construct that you can use instead of basename.&lt;BR /&gt;&lt;BR /&gt;To replace the ending ".I" with ".M", use:&lt;BR /&gt;&lt;BR /&gt;mv $ORIGINAL_FILE ${ORIGINAL_FILE%.I}.M&lt;BR /&gt;&lt;BR /&gt;You do need to use the curly brackets.&lt;BR /&gt;&lt;BR /&gt;Tom</description>
      <pubDate>Wed, 17 Jul 2002 12:27:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script/m-p/2765696#M73597</guid>
      <dc:creator>Tom Maloy</dc:creator>
      <dc:date>2002-07-17T12:27:26Z</dc:date>
    </item>
  </channel>
</rss>

