LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 12-16-2004, 12:55 PM   #1
sujith_deva
LQ Newbie
 
Registered: Dec 2004
Posts: 1

Rep: Reputation: 0
rename file with a pattern


Hi

i have a lot of file named like xxxx.doc.pdf i want to rename all the file in to xxxx.pdf

i hope a script will help me to do the job all the files contain in a directory

Thanks in advance

Sujith.V.S
 
Old 12-16-2004, 01:09 PM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 108Reputation: 108
Install the "mmv" (Multiple Move) package, and read its man page.
 
Old 12-16-2004, 01:13 PM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Must admit that mmv is probably the best way, if you want to 'write your own':

for THIS in *doc.pdf
do
echo ${THIS} ${THIS%%.doc.pdf}.pdf
done

replace echo with mv, cp whatever.
 
Old 12-16-2004, 02:19 PM   #4
Berto
Member
 
Registered: Sep 2003
Location: Stevenson, WA, USA
Distribution: Slackware
Posts: 232

Rep: Reputation: 30
Hey, I've been wondering about this too, but where do you find mmv? All I can find on google are links to the Debian site.
 
Old 12-16-2004, 02:51 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,005
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
http://www.google.co.nz/linux?hl=en&...a=lr%3Dlang_en

Odd ... no mention of Debilian in the first 10 hits ...



Cheers,
Tink
 
Old 12-16-2004, 03:01 PM   #6
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 108Reputation: 108
See also this:
http://wiki.linuxquestions.org/wiki/Mmv
 
Old 12-16-2004, 08:33 PM   #7
Berto
Member
 
Registered: Sep 2003
Location: Stevenson, WA, USA
Distribution: Slackware
Posts: 232

Rep: Reputation: 30
"Odd ... no mention of Debilian in the first 10 hits ..."

Yeah, but that's the New Zealand google, check out US google: http://www.google.com/search?q=mmv&s...en-US:official


EDIT: Dammit, forgot about Linux google...

Last edited by Berto; 12-16-2004 at 08:34 PM.
 
Old 12-16-2004, 08:39 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,005
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Quote:
Originally posted by Berto
"Odd ... no mention of Debilian in the first 10 hits ..."

Yeah, but that's the New Zealand google, check out US google: http://www.google.com/search?q=mmv&s...en-US:official


EDIT: Dammit, forgot about Linux google...
http://www.google.com/linux?hl=en&lr...=Google+Search

Just to please you ... and still no mention of debilian.


Cheers,
Tink
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
printing pattern match and not whole line that matches pattern Avatar33 Programming 13 05-06-2009 07:17 AM
How to recursively rename files using their directory name pattern ceg4048 Linux - General 2 09-28-2005 02:16 PM
pattern file with no return character ksun Linux - Newbie 1 12-28-2004 07:40 PM
Grep pattern first line of a file ericcarlson Linux - Newbie 11 07-20-2004 11:51 AM
multiline pattern search in a file mimi Linux - General 1 09-01-2002 01:22 PM


All times are GMT -5. The time now is 06:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration