Re: File Name Renaming

From: Chris F.A. Johnson (cfajohnson_at_gmail.com)
Date: 09/27/05

  • Next message: rashidaq_at_gmail.com: "Re: How to change certain field separated by comma"
    Date: Tue, 27 Sep 2005 12:28:12 -0400
    
    

    On 2005-09-27, BN wrote:
    > Greetings
    >
    > vebhqt02:/apps/opt/oracle>uname -a
    > SunOS vebhqt02.verizon.com 5.8 Generic_117350-25 sun4u sparc
    > SUNW,Ultra-Enterprise
    >
    >
    > I am trying to rename files with the following script
    >
    > for dir in $(find /u[0-9][0-9]/oradata/vchkuat1 -name "*.dbf" -print)
    > do
    > echo $dir
    > f=${dir/vchk/vchkuat1}
    > echo $f
    > # ls -ltr $dir
    > done
    > /u01/oradata/vchkuat1/system01.dbf
    > ksh[4]: f=${dir/vchk/vchkuat1}: bad substitution
    >
    > Dont know why it complains about bad substitution

       Probably because you are using a version of ksh which doesn't
       have search and replace expansion.

    > Part of the output without replacement string:
    >
    > /u07/oradata/vchkuat1/vchk_data_med_01.dbf
    > /u07/oradata/vchkuat1/pccwest_data_med_01.dbf
    > /u07/oradata/vchkuat1/arch_data_med_01.dbf
    >
    >
    > I want to rename the file vchk_data_med_01.dbf to vchkuat1_med_01.dbf
    >
    > Regards & Thanks
    > BN
    >

    -- 
        Chris F.A. Johnson                     <http://cfaj.freeshell.org>
        ==================================================================
        Shell Scripting Recipes: A Problem-Solution Approach, 2005, Apress
        <http://www.torfree.net/~chris/books/cfaj/ssr.html>
    

  • Next message: rashidaq_at_gmail.com: "Re: How to change certain field separated by comma"

    Relevant Pages