LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 11-12-2006, 12:00 PM   #1
zahadumy
Member
 
Registered: May 2005
Location: Cluj, Romania
Distribution: Fedora Core 6
Posts: 226

Rep: Reputation: 31
Multi-rename tool?


I have these files:
Code:
[cosmin@localhost (1994) - Emmerdale (disc 1)]$ ls -1
01 - The Cardigans - Sick & Tired.mp3
02 - The Cardigans - Black Letter Day.mp3
03 - The Cardigans - In The Afternoon.mp3
04 - The Cardigans - Over The Water.mp3
05 - The Cardigans - After All.mp3
06 - The Cardigans - Cloudy Sky.mp3
07 - The Cardigans - Our Space.mp3
08 - The Cardigans - Rise & Shine.mp3
09 - The Cardigans - Celia Inside.mp3
10 - The Cardigans - Sabbath Bloody Sabbath.mp3
11 - The Cardigans - Seems Hard.mp3
12 - The Cardigans - Last Song.mp3
Emmerdale.jpg
I want to rename each file so that it will not contain the first 5 characters of the filename. I can write a script that can to the trick using a for loop and inside do a cut on each file name and then a rename.
My question is if you know a tool that can to such things like this and more complicated... For example take the first 5 characters, skip 2, take next 10, and for each file replace "_" with a " ". I can write a script for this too, but if it's already out there I don't want to reinvent the wheel...
Thank you.
 
Old 11-12-2006, 12:44 PM   #2
b0uncer
Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Well...how about sed (stream editor) or awk (which is said to be more like a language than just a 'tool')?

EDIT: it's said (among other things) that Unix's philosophy is to do complicated tasks with simple tools rather than do simple tasks with complicated tools; thus using more than one small program, with piping for example, is more recommended than trying to find a huge program that is both heavy and big in size. Why? Since having small tools that, when combined, can do virtually anything you like, is more sensible than having some big tools that can only do certain tasks. Some day you'll invent a task that there is no tool for, and that day you can recombine your small tools to do the job.

So, instead of trying to find a single app you could ask yourself what the job actually is, if it's cut into pieces? Taking filenames from a list that is inside a file - that's reading the file and chopping the information in pieces. Ok. Then take each line and chop it into pieces, separated by certain marks. Ok. Then take only the relevant information. Ok. Then transform some letters to some other letters. Ok. Then put this all into a variable, for example, and do a rename. Ok. To me it sounds like every task can be done with the tools around; having a script around is not a bad thing, but if you like, you can probably do this using just the command line (I'd rather pick up the script).

Last edited by b0uncer; 11-12-2006 at 12:49 PM.
 
Old 11-12-2006, 01:10 PM   #3
zahadumy
Member
 
Registered: May 2005
Location: Cluj, Romania
Distribution: Fedora Core 6
Posts: 226

Original Poster
Rep: Reputation: 31
I know what you're talking about, but when I meant 'tool' I meant something with a GUI, not a command line. I used Windows XP and Fedora Core (3,4,5,6) for years and now I definetely switched to linux and I miss some applications I used in Windows. This is one of them.
I know how to use sed and awk and I know you can do anything with awk, but I need a GUI. And if I won't find it, probably I will write one because I like Java myself... Thank you.
 
Old 11-13-2006, 04:16 AM   #4
Seagull
Member
 
Registered: Oct 2003
Location: Holland
Distribution: SuSE 10.0 SuSE 10.2
Posts: 70

Rep: Reputation: 15
krename may be what you are looking for.
krename
 
Old 11-13-2006, 12:09 PM   #5
zahadumy
Member
 
Registered: May 2005
Location: Cluj, Romania
Distribution: Fedora Core 6
Posts: 226

Original Poster
Rep: Reputation: 31
That's what I was talking about... Why waste your time and write scripts when you can use this? Thank you my friend.
 
  


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
LXer: Linux powers multi-protocol, multi-frequency wireless switch LXer Syndicated Linux News 0 11-03-2006 09:54 AM
LXer: Linux powers multi-protocol, multi-frequency WAP LXer Syndicated Linux News 0 11-03-2006 09:33 AM
problems about multi-threading and/or multi-processing with tcp network in java ... alred Programming 5 06-23-2006 03:21 PM
How do you change card# of multi multi-media cards. Nichole_knc Slackware 3 12-01-2004 12:49 PM
GRUB, Multi Linux/Multi Disk Boot gtnorton Linux - Software 1 03-16-2003 03:48 AM


All times are GMT -5. The time now is 03:47 AM.

Main Menu
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