Sponsored Content
Full Discussion: Making a play-list
Top Forums Shell Programming and Scripting Making a play-list Post 302679733 by jkfloris on Tuesday 31st of July 2012 02:13:11 PM
Old 07-31-2012
Making a play-list

approximately the same question as the last time, but unfortunately I didn't get
a working answer.

I made a script with bash and gtkdialog that create a play-list. The output is for example :
Code:
gtk-media-pause | CB60471-05 - Gilbert, Brantley - Country Must Be Country Wide.zip | 28897 | /home/floris/Muziek/Karaoke/1341838939/CB60471-05 - Gilbert, Brantley - Country Must Be Country Wide.zip
gtk-media-pause | CB60471-06 - Parton, Dolly - Together You And I.zip | 13746 | /home/floris/Muziek/Karaoke/1341838939/CB60471-06 - Parton, Dolly - Together You And I.zip
gtk-media-pause | CB60471-07 - Campbell, Craig - Fish.zip | 6225 | /home/floris/Muziek/Karaoke/1341838939/CB60471-07 - Campbell, Craig - Fish.zip
gtk-media-pause | CB60471-08 - Rimes, LeAnn - Give.zip | 3386 | /home/floris/Muziek/Karaoke/1341838939/CB60471-08 - Rimes, LeAnn - Give.zip

I'm trying the move a song up the list..
In other words, how can I swap two lines?

I tried:
Code:
## $LIST is the play-list file
## $LINE is a random line from the play-list
## $UP_LINE is the line before $LINE
sed "s?$LINE?$UP_LINE?g;s?$UP_LINE?$LINE?g" "$LIST">"$LIST".bak

cat $LIST.bak
gtk-media-pause | CB60471-05 - Gilbert, Brantley - Country Must Be Country Wide.zip | 28897 | /home/floris/Muziek/Karaoke/1341838939/CB60471-05 - Gilbert, Brantley - Country Must Be Country Wide.zip
gtk-media-pause | CB60471-07 - Campbell, Craig - Fish.zip | 6225 | /home/floris/Muziek/Karaoke/1341838939/CB60471-07 - Campbell, Craig - Fish.zip
gtk-media-pause | CB60471-07 - Campbell, Craig - Fish.zip | 6225 | /home/floris/Muziek/Karaoke/1341838939/CB60471-07 - Campbell, Craig - Fish.zip
gtk-media-pause | CB60471-08 - Rimes, LeAnn - Give.zip | 3386 | /home/floris/Muziek/Karaoke/1341838939/CB60471-08 - Rimes, LeAnn - Give.zip

The expected is
Code:
gtk-media-pause | CB60471-05 - Gilbert, Brantley - Country Must Be Country Wide.zip | 28897 | /home/floris/Muziek/Karaoke/1341838939/CB60471-05 - Gilbert, Brantley - Country Must Be Country Wide.zip
gtk-media-pause | CB60471-07 - Campbell, Craig - Fish.zip | 6225 | /home/floris/Muziek/Karaoke/1341838939/CB60471-07 - Campbell, Craig - Fish.zip
gtk-media-pause | CB60471-06 - Parton, Dolly - Together You And I.zip | 13746 | /home/floris/Muziek/Karaoke/1341838939/CB60471-06 - Parton, Dolly - Together You And I.zip
gtk-media-pause | CB60471-08 - Rimes, LeAnn - Give.zip | 3386 | /home/floris/Muziek/Karaoke/1341838939/CB60471-08 - Rimes, LeAnn - Give.zip

I hope that someone give me an example with sed, awk, perl or any other line editor.

note: The play-list is random made. I only know the line I have selected. So a
solution with line numbers doesn't work. Also please notice that the variables can
contain almost any character.
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

play cd? how?

hi all, How do I set up my cdrom to play some regular audio cd (not cd-r or cd-rw). I know that my cdrom has been mounted as it does pop up the file manager if I put in, e.g., the office52 cd. Thanks in advance. Andre (3 Replies)
Discussion started by: andrec
3 Replies

2. UNIX for Advanced & Expert Users

Need something new to play with

I posted this question in the dummies forums, but I would like to get a more expert opinion... I am looking for a new OS to play with. I have a celron 450 running slackware linux, a powermac G4 450 running Mac OS X (Which by the way has 81 days of uptime as of this moment), a PowerBook G3 running... (5 Replies)
Discussion started by: dewhite04
5 Replies

3. UNIX for Dummies Questions & Answers

How Can I Play A Cd On Unix

HI I AM A FRESH NEW USER ...I MEAN I JUST GOT A COMPUTER ALMOST FOR FREE AND IT RUNS UNIX WHICH I DIDN'T EXPECT AND DONT KNOW HOW TO WORK ON IT I THOUGHT IT'LL BE WITH WINDOWS ..YOU KNOW SO HOW DO I PLAY A CD IN IT. REMEMBER I KNOW NOTHING ABOUT UNIX , BUT I THINK I'LL GET OVER IT... (1 Reply)
Discussion started by: IMOTEB
1 Replies

4. UNIX for Advanced & Expert Users

play

dear friends, i have linux system . can i play songs in linux system. like winamp player in windows. let me know. (2 Replies)
Discussion started by: rajan_ka1
2 Replies

5. Linux

how can i play the gam

can some1 tell me how to start playing? (2 Replies)
Discussion started by: 123456
2 Replies

6. Shell Programming and Scripting

making a list matching certain criteria in bash...

Hello everyone!I am trying to make a mail list(a simple .txt file)in which i put certain records that match specific criteria. Let's say that i have a(sorted by last column file)like this one: 0100567 Bla1 Lala1 100 1234567 Bla2 Lala2 80 8769029 Bla3 Lala3 70 1001007 ... (0 Replies)
Discussion started by: bashuser2
0 Replies

7. Shell Programming and Scripting

Problem in making a list with awk

Hi bodies,I am doing a list from a .txt file with awk commands but something is wrong. The .txt file looks like: 32782 28 18 32783 02 18 32784 01 18 32785 29 18 32786 25 23 32787 25 18 32788 00 18 32789 25 26 32790 02 23 32791 29 26 ... (2 Replies)
Discussion started by: Behrouzx77
2 Replies

8. Shell Programming and Scripting

Play sound

hi i want to produce digit sounds.for ex: if my input text is four five six then code should able to produce sounds corresponding to digits which are stored in some directory as four.wav,five.wav etc.Please help me (8 Replies)
Discussion started by: sreejithalokkan
8 Replies
tonetool(1)								OST							       tonetool(1)

NAME
tonetool - create and manipulate telephony tones. SYNOPSIS
tonetool -append [-offset=pos] [-level=level] target tonespec... tonetool -create [-encoding=codec] [-level=level] target tonespec... tonetool -detect input files... tonetool -list [-file=config] [-locale=where] tone tonetool -play [-level=level] tonespec... DESCRIPTION
Teltones is used to generate or play audio telephony tones based on a "spec". The spec can be "dtmf digitstring" to create or play dtmf digits, "mf digitstring" to create or play mf digits, "single ...", to create or play a single tone, or "dual ..." to create or play a dual tone. Teltones can also be used to detect dtmf digits contained in audio files. -append Appends the generated tone to the end of an existing audio file. -create Create a new audio file from scratch and fill with the tone specified. -detect Process an existing audio file and report on dtmf digits found. -list List a tone entry definition by sequencing. -play Generate a tone or dialing string and play it to the local soundcard. BUGS
At this time tonetool always assumes all data is sourced at 8khz and does not support sample rate conversion. AUTHOR
Written by David Sugar. REPORTING BUGS
Report bugs to <dyfet@gnu.org>. COPYRIGHT
Copyright (C) 2005 David Sugar, Tycho Softworks. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU- LAR PURPOSE. GNU ccAudio Tone Tool Febuary 2005 tonetool(1)
All times are GMT -4. The time now is 08:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy