I have a file that looks like
title="title1"
artist="artist1"
title="title2"
artist="artis2"
title="title3"
artist="artist3"
And so on
this command
perl -pe 's/title="(.*?)"\n//ig' list.txt
Is not working as I'd hope. If I do that alone, I get just the artist lines, BUT if I do this
perl -pe 's/title="(.*?)"\nartist//ig' list.txt
It doesn't match at all.
I've tried with and without the /g and tried with the addition of a /m
I've look at the file in nano, and I don't see any additional characters between the final " in each line and the "artist" in the next.
Anyone know what I'm doing wrong? (I'm using perl rather than sed, because the regex that generates this list uses a negative lookahead).
My goal is to be able to use a line like below
perl -pe 's/title="(.*?)"\nartist="(.*?)"(?:\n|$)/\2 - \1/ig' list.txt
That would output something like
artist1 - title1
artist2 - title2
artist3 - title3