[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

m3u copy shell script. (need help :)



Hello!

I wanted to create a tiny script which reads a .m3u file, and then copies the "real" mp3 files which has an entry in the m3u file to a given dir.

Here is my idea:

---------- # Script # ----------
#!/bin/bash
TMP=/tmp/cpm3u_tmp
cat "$1" | grep -v --regexp="#" > $TMP
for line in $(<$TMP); do
 echo "$line";
done
---------- # Script # ----------

A problem occurs, when there is a .m3u file, which has entries with spaces in their names, like this:

---------- # m3u file # ----------
#EXTM3U
#EXTINF:278,Republic - Igen - Hozd El Azt A Napot
/home/leva/Zene/Republic/1996 Igen/02. Hozd El Azt A Napot.mp3
---------- # m3u file # ----------

I get an output like this:

---------- # Output # ----------
/home/leva/Zene/Republic/1996
Igen/02.
Hozd
El
Azt
A
Napot.mp3
---------- # Output # ----------

What should I do?
Thanks!

--
LeVA




Reply to: