![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | 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 !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Comparing filename-substrings and remove unnecessary files | cypher82 | UNIX for Dummies Questions & Answers | 5 | 06-06-2008 01:26 AM |
| Remove path from filename | borgeh | UNIX for Dummies Questions & Answers | 3 | 08-23-2007 07:58 AM |
| Use same filename for prefix in the split command | namityadav | UNIX for Dummies Questions & Answers | 1 | 07-25-2006 01:24 PM |
| Remove prefix from filenames | HLee1981 | Shell Programming and Scripting | 6 | 01-25-2006 11:57 AM |
| remove pound sign from filename | kristy | UNIX for Dummies Questions & Answers | 4 | 02-13-2002 11:31 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
remove filename prefix
I've got a bunch of files called oldabc, olddef etc.
i want to copy these to be abc, def.... I can do this with file extensions....but can get the logic to work for prefixes. All the files I am interested in have a prefix of 'old'. This loop is no good for me....it looks at the content of the files...rather than changing the filename. for files in `ls *fmt`; do newfilename="cut -c4-50 $files"; cp $files $newfilename; done How do I get it to look at the filename and change it - rather than the content of the file?
__________________
Pete |
| Forum Sponsor | ||
|
|
|
|||
|
>for files in `ls *fmt`;
>do newfilename="cut -c4-50 $files>"; >cp $files $newfilename; >done Code:
for files in `ls *fmt` do newfilename=`echo $files | cut -c4-` cp $files $newfilename done Last edited by hell666; 07-11-2002 at 06:15 AM. |