![]() |
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 |
| mv command to rename multiple files that retain some portion of the original file nam | grimace15 | Shell Programming and Scripting | 4 | 12-21-2008 06:27 AM |
| Rename file based on first 3 characters of data in file | jchappel | UNIX for Dummies Questions & Answers | 3 | 10-01-2008 02:21 PM |
| rename file to file.ext.datetime | tripsat | Shell Programming and Scripting | 2 | 09-20-2007 04:12 PM |
| Not able to rename file | MANISH KU | Shell Programming and Scripting | 2 | 06-27-2007 04:07 AM |
| Help with multiple file rename - change case of part of file name | steve7 | UNIX for Dummies Questions & Answers | 7 | 06-30-2005 01:41 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Rename multiple file from file listing
I am new at Linux/UNIX programming. Here is my problem.
I had one big file which I split using the command csplit -k -s -f april.split. april '/^ISA/' '{10000}' So now I have multiple files with names april.split.01 april.split.02 april.split.03 But I need the name of the file like CHRY.850.01 CHRY.850.02 CHRY.850.03 etc. Can I use following commands on the prompt or do I have to write a script. for each in `cat april-850-split` do cp $each ${each}.850 Thanks |
|
||||
|
Thanks for your reply. You are correct. I do need CHRY.850.01 etc. When I ran you code, I am getting
mv april.split.03 CHRY.850. mv april.split.04 CHRY.850. mv april.split.05 CHRY.850. without the number. Here is my code. $ cat april-850-list | while read each; do number=${each##*.} echo mv $each CHRY.850.$number done | tee repl.sh; Can you please tell me what is wrong with my code? I ma running on Linux. I don't think that would make a difference. Thanks |
|
|||||
|
Quote:
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|