LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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, 11:55 AM   #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, 12:09 PM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

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

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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, 01: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, 01:51 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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, 02:01 PM   #6
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
See also this:
http://wiki.linuxquestions.org/wiki/Mmv
 
Old 12-16-2004, 07: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 07:34 PM.
 
Old 12-16-2004, 07:39 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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



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 06:17 AM
How to recursively rename files using their directory name pattern ceg4048 Linux - General 2 09-28-2005 01:16 PM
pattern file with no return character ksun Linux - Newbie 1 12-28-2004 06:40 PM
Grep pattern first line of a file ericcarlson Linux - Newbie 11 07-20-2004 10:51 AM
multiline pattern search in a file mimi Linux - General 1 09-01-2002 12:22 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:28 PM.

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
Open Source Consulting | Domain Registration