![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Renaming multiple files | jayell | Shell Programming and Scripting | 7 | 01-12-2009 04:27 PM |
| Removing certain text from multiple filenames | Djaunl | UNIX for Dummies Questions & Answers | 6 | 01-15-2008 05:52 PM |
| Renaming of multiple filenames | shashi_kiran_v | UNIX for Dummies Questions & Answers | 4 | 07-11-2005 08:57 AM |
| Renaming multiple files | rmayur | UNIX for Dummies Questions & Answers | 6 | 02-26-2004 04:40 AM |
| renaming multiple files | piltrafa | UNIX for Dummies Questions & Answers | 6 | 11-10-2001 12:27 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Try this
#! /bin/ksh
i=0 for list in `ls -l file*` do if [ $i -lt 99 ] then tmp=`echo $list| sed "s/^[a-z]*[0-9]*$/flat$i/"` mv path_to_dir/$i path_to_dir/$tmp i=$((i+1)) ; fi tmp=`echo $list| "sed s/^\([a-z]\)\([0-9]*\)/flat\2/"` mv path_to_dir/$i path_to_dir/$tmp done < /tmp/files.txt ( not tested ) |
|
||||
|
hi,
you can try this, as far i had tested it works, plz let me know if there are any errors or anything to be clarified ----------------------------------------------------- for i in `ls flat*` do echo $i > cls val=`awk '{print substr($i,length($i)-2,3);}' cls` mv $i file`expr $val + 0` done rm -f cls exit 0 ----------------------------------------------------- |
|
|||||
|
Quote:
Is it not for i in `ls file*` ?? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|