![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| rename multiple files | antointoronto | Shell Programming and Scripting | 13 | 03-20-2008 10:16 AM |
| How to rename multiple files with a common suffix | er_ashu | UNIX for Dummies Questions & Answers | 1 | 09-28-2007 10:52 AM |
| Rename part of multiple files | sajjad02 | Shell Programming and Scripting | 4 | 02-22-2005 01:30 PM |
| Rename multiple files | luiz_fer10 | UNIX for Dummies Questions & Answers | 7 | 06-11-2002 08:06 AM |
| Rename Multiple Files | molonede | UNIX for Dummies Questions & Answers | 1 | 11-14-2000 12:40 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||||
|
Yeah...but it is a rather complex command and requires a powerful shell (I'm using ksh). We need a pattern that will match those 4 files and only those 4 files. I will assume that 01.AR.* will do that.
Code:
$ ls *AR*
01.AR.asset 01.AR.asset.vf 01.AR.asset.xv 01.AR.index
$ for i in 01.AR.* ; do mv $i 73${i#01}.Z ; done
$ ls *AR*
73.AR.asset.Z 73.AR.asset.xv.Z
73.AR.asset.vf.Z 73.AR.index.Z
$
|
|
|||||
|
${i} is the value of the variable i
${i#01} is the value of the variable i with any leading "01" removed That leading 73 is just like the trailing .Z which you didn't ask about. We are just tacking some constant text on to both ends of the value of the variable. |
|
||||
|
rename multiple files
Hi tyub,
This is Antony. Do you remember me.? you want to use this in Kerridge AR module. its like this for i in * do mv $i $i.Z done Hopefully this helps you.. Regards, Antony |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|