SRL Archive - Help and Support

Linux 'sed' help


Justin

2012-10-28 23:08:14

Hey all.

I am currently downloading some playlists from YouTube with jDownloader (Linux VPS(Debian)) and I am wanting to tidy up the names of the downloaded files..

They are currently all like this (Have already converted them)

Above & Beyond - Sun In Your Eyes(360p_H.264-AAC).mp4.mp3
Skizzy Mars - Colours(1080p_H.264-AAC).mp4.mp3
Macklemore - Otherside Ft. Fences (Official Music Video)(1080p_H.264-AAC).mp4.mp3

What I am wating to do it run a batch file via terminal to strip the 'junk' from the filename..

The end result I am wanting is something like this

Above & Beyond - Sun In Your Eyes.mp3
Skizzy Mars - Colours.mp3
Macklemore - Otherside Ft. Fences (Official Music Video).mp3

Any help would be good

Justin.

Dgby714

2012-10-28 23:37:16

Removes all but the last extension and anything in parentheses…

Tho seems to leave an extra space in the third one =/

sed 's/\(.*\)\s-\s\([^\\\\(]*\).*\.\(\.*\)/\1 - \2.\3/'

Justin

2012-10-29 00:02:11

From: Dgby714
Removes all but the last extension and anything in parentheses…

Tho seems to leave an extra space in the third one =/

sed 's/\(.*\)\s-\s\([^\\\\(]*\).*\.\(\.*\)/\1 - \2.\3/'


Thanks Dgby!