I have a number of Windows based .m3u playlists - they start with ..\..\
and have \
instead of /
for folder paths, whereas Ubuntu prefers they start with /media/usr/part/dir/
(i.e. the absolute path).
I want to make the following changes
- Replace all
..\..\
with/media/usr/part/dir/
- Replace all
\
with/
I tried using find /home/user/directory -name \*.m3u -exec sed -i "s/\.\.\\\.\.\/\/media\/usr\/part\/dir\//g" {} \;
as suggested here, and tried using _
and :
as delimiters as suggested here.
However, I keep getting
sed: -e expression #1, char 36: unterminated `s' command
How do I make the necessary replacements in my files?
I had no idea
– 3l4ng Jul 09 '15 at 20:05sed
replacemets could be given on the same line in a python-ish manner. And I don't need to use//
when I want to replace a frontslash (i.e./
char) in the file ?/
they are interpreted as the separator (much like it happened with your command): I changed the separator to|
exactly because of that, because using/
would have lead to this (less intelligible) command:s/\.\.\\\.\.\\/\/media\/usr\/part\/dir\//; s/\\/\//g
– kos Jul 10 '15 at 03:06