Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
[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.
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).
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.