![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum 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 |
| rename a lot of files again | ajp7701 | Shell Programming and Scripting | 11 | 03-31-2008 04:36 PM |
| rename files help | piltrafa | UNIX for Dummies Questions & Answers | 2 | 10-04-2007 06:47 AM |
| trying to rename the files in dir | hankooknara | Shell Programming and Scripting | 8 | 07-02-2007 12:36 AM |
| How to rename files? | CompuTelSystem | UNIX for Dummies Questions & Answers | 9 | 05-14-2002 12:28 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Rename a number of files using grep
Hi all,
I'm trying to rename a directory of html-files: index.php?page=start should become start.html I've lost track of all the pipes and brackets and decided I need some help ;-) Many thanks. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
I am sorry, but I do not quite understand your question.
rename: the command is mv (be it directory or file if you want to rename multiple files, you need a loop, something like for i in `ls ` do ..... done
__________________
War doesnt determine who is right, it determines who is left |
|
#3
|
|||
|
|||
|
Sorry for being confusing.
I have multiple files in 1 directory, they are called: index.php?page=start index.php?page=info index.php?page=contact etc... And I want to rename them all into start.html info.html contact.html etc... thanks again. |
|
#4
|
||||
|
||||
|
See if this works:
for i in `ls index*`; do mv $i `echo $i | awk -F= '{print $2'}`.html; done |
|
#5
|
|||
|
|||
|
That worked
I'm heading for the man pages now to find ot why ;-) Thanks a lot. |
|||
| Google The UNIX and Linux Forums |