script for compiling a playlist
ok i use liquidsoap to play a stream of music and i have created a script to make a playlist and i was woundering how to get the list to form in alphebetical order right now i have
find /icecast -name '*.mp3' > /test.txt and that compiles a random list of the mp3's what would i have to add for it to be alpebetical?? |
Pipe the output of find to sort
Code:
find /icecast -name "*.mp3" | sort > /test.txt |
thanks that was simple and quick thanks colucix
do you know if there was a way i could get a file to insert in to the play list in between each ex: 1broadcast.mp3 annoucment.mp3 2broadcast.mp3 i ask this cause all my mp3's are dated and i would like to insert a annoucement between them |
Save the below lines in a file (say song.sh)
After changing the permissions etc, do ./song.sh < test.txt lines=`wc -l test.txt | cut -f 1 -d" "` while [ $lines -gt 0 ] do read song echo $song echo /path/ann.mp3 lines=`expr $lines - 1 ` done (Hmm... I think I feel really bored today :) ) |
Do you want to insert the same line "announcement.mp3" between each line? You can do in many ways using sed or awk one-liners, for example:
Code:
awk '{print; print "announcement.mp3"}' test.txt Code:
sed -i 's/$/\nannouncement.mp3/g' test.txt |
thanks guys i'll test them when i get a chance
|
with the sed command what is the change to make it every 2 lines or more
|
Code:
sed -i '0~3{s/$/\nannouncement.mp3/}' test.txt |
thanks again colucix
|
All times are GMT -5. The time now is 04:48 PM. |