![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| rename multiple files | antointoronto | Shell Programming and Scripting | 13 | 03-20-2008 06:16 AM |
| How to rename multiple files with a common suffix | er_ashu | UNIX for Dummies Questions & Answers | 1 | 09-28-2007 07:52 AM |
| Rename part of multiple files | sajjad02 | Shell Programming and Scripting | 4 | 02-22-2005 09:30 AM |
| Rename multiple files | luiz_fer10 | UNIX for Dummies Questions & Answers | 7 | 06-11-2002 05:06 AM |
| Rename Multiple Files | molonede | UNIX for Dummies Questions & Answers | 1 | 11-14-2000 08:40 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
| Forum Sponsor | ||
|
|
|
||||
|
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 |
|||
| Google The UNIX and Linux Forums |