LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 08-21-2006, 02:05 PM   #1
citrus
Member
 
Registered: Dec 2003
Location: California
Distribution: Kubuntu 6.1
Posts: 548

Rep: Reputation: 30
find awk sed.. something along these lines


hey guys..

got a question thats bothering me..

i need to randomize the order in a text file for my mp3 server
and also put in a specific line for every other entry

right now as i upload mp3s to my linux server there all stored in one directory

music/mp31.mp3
music/mp32.mp3
music/mp33.mp3
music/and.so.on.mp3


any ways what i do right now to create my play list file is
'find music > play.lst'

and the output is the same as above

what i need is a way to randomize the the output into that file so its more like

music/mp33.mp3
music/mp32.mp3
music/mp34.mp3
music/mp31.mp3


also i would like to find an easier way to put this line in every other line

music/slogan.mp3

so it would be like this

music/slogan.mp3
music/mp32.mp3
music/slogan.mp3
music/mp34.mp3
music/slogan.mp3
music/mp33.mp3
music/slogan.mp3
music/mp31.mp3
music/slogan.mp3

i am guessing something like this can easily be acomplished

if you guys could help me out i would appreciate it
 
Old 08-21-2006, 03:04 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,310
Blog Entries: 54

Rep: Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860Reputation: 2860
If this is about broadcasting, isn't there SW at Freshmeat or Sourceforge that does this already? There's also a tool called unsort you just pipe your find results through to randomise the list and then adding your callsign is just another pipe away:
Code:
find /some/dir -type f -iname "*.mp3"|unsort|while read song; do
echo -en "music/slogan.mp3\n${song}\n"; done >  play.lst
 
  


Reply


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
awk/gawk/sed - read lines from file1, comment out or delete matching lines in file2 rascal84 Linux - General 1 05-24-2006 09:19 AM
Sed and Awk Gins Programming 7 04-19-2006 10:32 AM
awk text that is on several lines homey Programming 2 10-31-2004 09:27 AM
awk/sed help pantera Programming 1 05-13-2004 11:59 PM
counting the commented lines using awk [ /* */] itsjvivek Linux - General 8 01-17-2003 08:30 AM


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

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