Music Playlist parse/grep


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Music Playlist parse/grep
# 1  
Old 06-08-2012
Music Playlist parse/grep

Hi.
Please help with a single line bash that will match field 3, and field 2 , if not then echo "Not Found".

Original Music List name; Musiclists.m3u

Format:
Code:
\Music\The Rolling Stones - Angel.mp3
\Music\Maroon 5\Moves Like Jagger.mp3

Make a groomed playlist variable...
Code:
$ playlist="$(cat Musiclists.m3u | sed -e 's/\(.*\)\\/\1;/' -e 's/\(.*\)\ -\ /\1;/' -e 's/\\/\//g' -e 's/\\/\//g' -e 's/.mp3//')

$ echo "$playlist"
/Music/;The Rolling Stones;Angel
/Music/;Maroon 5; Moves Like Jagger

I've got the following to work if I use the actual names, but I want to substitute for every line fed with a variable for field 3 and 2.

Code:
- $ grep -i -w -E 'Stones.*angel' Musiclists.m3u
- $ if ! grep Stones Musiclists.m3u ; then echo "Not Found"; fi
- $ grep -i -w Angel Musiclists.m3u | grep -i -w Stones

How can I correctly...
Code:
$ echo "$playlist" | while read z; do grep -i -w <field3> Musiclists.m3u | grep -i -w <field2> || echo "Not Matched" ; done

I'm not sure which is the best way to go about this.


Thank you.

Last edited by Scrutinizer; 06-08-2012 at 08:45 AM.. Reason: code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. What is on Your Mind?

Video Playlist for New Users with Under 5 Posts

Hi. I'm working on showing the video player to new users with under 5 posts which shows only videos like the ones below, which are related to the forums, how to use the forums, code tags, usercp, etc.: https://www.unix.com/members/1-albums215-picture1265.png or maybe something minimal and... (5 Replies)
Discussion started by: Neo
5 Replies

2. Shell Programming and Scripting

Help with Playlist creation script

Hello. I am hoping to have an automated way to create Playlist files from Genre txt files I'll be making with my music collection. This is for use with my WD Live player, and is so that certain albums / artists can live in multiple genre directories when I browse to them from my WD Live player. ... (4 Replies)
Discussion started by: Davinator
4 Replies

3. Shell Programming and Scripting

Grep/Parse a .xml file

I have a .xml file similar to the following: <Column> <Name>FIELD1</Name> <Title>CO.</Title> </Column> <Column> <Name>FIELD2</Name> <EditField>TextBox</EditField> <ColumnSpan0>4</ColumnSpan0> <Title>NORMAL</Title> ... (12 Replies)
Discussion started by: jl487
12 Replies

4. Shell Programming and Scripting

a playlist for ffmpeg streamer

Hi, I hope I am posting in the right place. I use to stream to justin tv using ffmpeg with that command ffmpeg -re -i "path/to/input.avi" -vcodec libx264 -preset fast -crf 30 -acodec libfaac -ab 128k -ar 44100 -f flv rtmp://live.justin.tv/app/xxxxxxxxxxx I would like to know if a bash... (2 Replies)
Discussion started by: undercash
2 Replies

5. Shell Programming and Scripting

to parse (or grep) a number from a datafile and write it to tab limited file

Hi All, I have a folder that contain 100's of subfolders namely: Main folder -> GHFG - Subfoders ->10 100 234 102 345 .. .. ... (2 Replies)
Discussion started by: Lucky Ali
2 Replies

6. UNIX for Dummies Questions & Answers

parse text or complex grep ?

I have the following file (records from db) and I need to retrieve in another file only two variables and their values. I have a command but works only for one value. grep ^mob: R25-subs.ldi | sed 's/mob: //' | sort | uniq >text_output Can someone please help me? dn:... (4 Replies)
Discussion started by: jacost
4 Replies
Login or Register to Ask a Question