Help answer threads with 0 replies.
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, 02: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, 04: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 06:05 PM
Need to extract info out of a binary file synapse Programming 6 09-27-2005 04:55 AM
Extract text from a html file gsphanikumar6 Linux - Newbie 2 08-20-2004 01:11 PM
extract text portions from html files linuxfond Programming 3 04-28-2004 11:00 AM
"how do I extract a number from a text file using shell command?" sdandeker Linux - Networking 3 02-12-2004 08:54 AM > Forums > Non-*NIX Forums > Programming

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

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