You are not logged in.

#1 2016-01-24 00:02:40

Döbbie03
Resident Metalhead
From: New Zealand
Registered: 2015-09-29
Posts: 3,872

[SOLVED] Trying to edit an epic Playlist file

So I am trying to edit a playlist file which has multiple expressions that are 99% the same but I don't know how to edit these all at once.  My playlist is quite huge so I am avoiding going through line by line.

Does anyone know what a good editor is that can change:

File220=Music/N/Napalm Death/(1988) From Enslavement To Obliteration/07-Uncertanity Blurs The Vision.mp3
File221=Music/N/Napalm Death/(1988) From Enslavement To Obliteration/08-Cock-Rock Alienation.mp3
File222=Music/N/Napalm Death/(1988) From Enslavement To Obliteration/09-Retreat To Nowhere.mp3
File223=Music/N/Napalm Death/(1988) From Enslavement To Obliteration/10-Think For A Minute.mp3
File224=Music/N/Napalm Death/(1988) From Enslavement To Obliteration/11-Display To Me.mp3
File225=Music/N/Napalm Death/(1988) From Enslavement To Obliteration/12-From Enslavement To Obliteration.mp3
File226=Music/N/Napalm Death/(1988) From Enslavement To Obliteration/13-Blind To The Truth.mp3
File227=Music/N/Napalm Death/(1988) From Enslavement To Obliteration/14-Social Sterility.mp3
File228=Music/N/Napalm Death/(1988) From Enslavement To Obliteration/15-Emotional Suffocation.mp3
File229=Music/N/Napalm Death/(1988) From Enslavement To Obliteration/16-Practise What You Preach.mp3
File230=Music/N/Napalm Death/(1988) From Enslavement To Obliteration/17-Inconceivable_.mp3
File231=Music/N/Napalm Death/(1988) From Enslavement To Obliteration/18-Worlds Apart.mp3
File232=Music/N/Napalm Death/(1988) From Enslavement To Obliteration/19-Obstinate Direction.mp3
File233=Music/N/Napalm Death/(1988) From Enslavement To Obliteration/20-Mentally Murdered.mp3
File234=Music/N/Napalm Death/(1988) From Enslavement To Obliteration/21-Sometimes.mp3
File235=Music/N/Napalm Death/(1988) From Enslavement To Obliteration/22-Make Way!.mp3
File236=Music/N/Napalm Death/(1988) From Enslavement To Obliteration/23-Musclehead.mp3
File237=Music/N/Napalm Death/(1988) From Enslavement To Obliteration/24-Your Acheivement.mp3
File238=Music/N/Napalm Death/(1988) From Enslavement To Obliteration/25-Dead.mp3
File239=Music/N/Napalm Death/(1988) From Enslavement To Obliteration/26-Morbid Deceiver.mp3
File240=Music/N/Napalm Death/(1988) From Enslavement To Obliteration/27-The Curse.mp3

to

Music/N/Napalm Death/(1988) From Enslavement To Obliteration/07-Uncertanity Blurs The Vision.mp3
Music/N/Napalm Death/(1988) From Enslavement To Obliteration/08-Cock-Rock Alienation.mp3
Music/N/Napalm Death/(1988) From Enslavement To Obliteration/09-Retreat To Nowhere.mp3

I.e. removing the "File" with the numerical part.

Last edited by Döbbie03 (2016-01-24 00:17:11)


"All we are is dust in the wind, dude"
                                       - Theodore "Ted" Logan
"Led Zeppelin didn't write tunes that everybody liked, they left that to the Bee Gees."
                                       - Wayne Campbell

Offline

#2 2016-01-24 00:10:05

porkpiehat
Member
Registered: 2015-10-27
Posts: 31

Re: [SOLVED] Trying to edit an epic Playlist file

awk -F= '{print $2}' epic-playlist > new-playlist

(replace 'epic-playlist' with the actual name of the file, and 'new-playlist' with the name of the new list)

Last edited by porkpiehat (2016-01-24 00:12:29)

Offline

#3 2016-01-24 00:16:56

Döbbie03
Resident Metalhead
From: New Zealand
Registered: 2015-09-29
Posts: 3,872

Re: [SOLVED] Trying to edit an epic Playlist file

Genius!

Thanks so much.


"All we are is dust in the wind, dude"
                                       - Theodore "Ted" Logan
"Led Zeppelin didn't write tunes that everybody liked, they left that to the Bee Gees."
                                       - Wayne Campbell

Offline

#4 2016-01-24 00:58:52

porkpiehat
Member
Registered: 2015-10-27
Posts: 31

Re: [SOLVED] Trying to edit an epic Playlist file

You're welcome!

Another option is "cut" :

cut -d= -f2 epic-playlist > new-playlist

Both awk and cut do the same thing here -- separate the lines at the =, and print only the second field (everything after the = )

Last edited by porkpiehat (2016-01-24 01:03:03)

Offline

#5 2016-01-24 01:44:48

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,030

Re: [SOLVED] Trying to edit an epic Playlist file

I was going to suggest sed:

sed -i -e 's/^.\{8\}//' /path/to/playlist/play_list

EDIT:  Looking at John's post below:

sed -i s/.*=// ~/playlist

Nice... learned a new one.

Last edited by Sector11 (2016-01-24 12:04:07)


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#6 2016-01-24 03:04:49

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,668
Website

Re: [SOLVED] Trying to edit an epic Playlist file

Just to add yet another method:
Geany also has built-in search-and-replace, which can use regular expressions.
Search>Replace...
Check "Use regular expressions".
Put

.*=

in "Search for:"
Leave "Replace with:" empty, and click "Find" "Replace" or "Replace & Find" to taste.
Handy if you've already opened the file anyway.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#7 2016-01-24 03:55:54

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,057

Re: [SOLVED] Trying to edit an epic Playlist file

I use CTRL+H in geany all the time. Very handy when you need to replace all occurrences of a variable with something else, for instance.

Offline

#8 2016-01-24 13:06:42

porkpiehat
Member
Registered: 2015-10-27
Posts: 31

Re: [SOLVED] Trying to edit an epic Playlist file

Or use vim:

:%s/.*=//gc

(-:

Offline

#9 2016-01-25 02:42:30

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,668
Website

Re: [SOLVED] Trying to edit an epic Playlist file

(Heretic in me speaking) one advantage of doing a search-and-replace in a GUI is that you can check you really want to replace each string before you do it. Unless you've been extremely careful to craft a watertight regex you often find geany trying to change something extra...


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

Board footer

Powered by FluxBB