I am trying to change the path in whole lot of m3u files. I know I can do it with regexxer f.e. but I'm trying to learn bash.
This is the command I figured out, but it is not working.
grep -lr -i -e 'M:\\' * | xargs -0 sed -i 's/M:\\/T:\\/g'
I suspect, but only suspect, it is due to special characters in filenames. How to deal with that?
-0
option toxargs
is wrong here, because it means thegrep
should send filenames separated by a NUL, which is not true (ok, it could be obtained by some grep option). Second, avoid usingxargs
in general, there are always better and safer ways to do the same thing. Lastly, it could help if you can show an input file, or at least some lines.