Did you know LQ has a Linux Hardware Compatibility List?
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 07-23-2003, 03:18 AM   #1
LQ Newbie
Registered: Jul 2003
Posts: 2

Rep: Reputation: 0
Question linux shell - extract filename from and song info from text database


I have filename that contains following mp3 song information:

4344;Eric Clapton;Change the World;Y;0;002

The song files are located under different directories, for example: /Y/0/filename.mp3, or /X/2/filename.mp3

I need to write a script (shell) that would rename the files to the real artist and song names and copy them to single location, basically after extracting data from the upper file I need to get command similar to:

cp Y/0/002.mp3 Cher - Believe.mp3


cp X/4/009.mp3 Aerosmith - Amazing.mp3

I hope I was clear enough of my needs and I really need your help on this, since I've been trying for two days now, without any success.

Old 07-23-2003, 05:06 AM   #2
LQ Newbie
Registered: Jul 2003
Posts: 2

Original Poster
Rep: Reputation: 0

Allready found the solution, if anyone need something similar here is it:

awk 'BEGIN {FS=";"} { printf("cp %s/%s/%s.mp3 \"new_directory/%s - %s.mp3\"\n", $4, $5, $6, $2, $3) }' file_list | sh

Asuming that the new files will go to new_directory and filelist is in file_list file.


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
Restoring *.sql database from Linux Fedora's shell marciano Linux - Newbie 1 10-19-2005 07:05 PM
Need to extract info out of a binary file synapse Programming 6 09-27-2005 05:55 AM
Extract text from a html file gsphanikumar6 Linux - Newbie 2 08-20-2004 02:11 PM
extract text portions from html files linuxfond Programming 3 04-28-2004 12:00 PM
"how do I extract a number from a text file using shell command?" sdandeker Linux - Networking 3 02-12-2004 09:54 AM

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

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