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 :
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:
## $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
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.