Tag Info

New answers tagged

0

As others have noted, tr only transforms a single character into another single character. You can use my JREPL.BAT regular expression text processing utility to easily and efficiently solve your problem. It is pure script (hybrid JScript/batch) that runs natively on any Windows machine from XP onward. jrepl "\" "\\" /l /f file.txt /o - The above will ...


0

Tr translates only single character. To replace it with more than one char it is needed to use sed. It can be found in GnuWin32 - port of linux tools for Windows. To replace \ with \\ you should use f.e. cat file | sed "s_\\_\\\\_g" The s is for separate mode, g stands for global - in default sed replaces only first occurence in row. \\\\ instead of ...


0

tr deals with individual characters, it doesn't really deal with strings, though there is overlap. you can replace multiple occurrences of a single character, with one occurrence( Replacing \\ with \), an option it calls 'shrink' but you'd want the other way. In theory one could say that involves an individual character just as much, nevertheless, tr ...



Top 50 recent answers are included