5/13/2023 0 Comments Slash by Slash![]() ![]() ' s / \ / / / g' which will replace all backslashes with forward slashes. Putting these inside the 's/OLD_TEXT/NEW_TEXT/g' paradigm you get Slash is the debut album by American rock and roll musician Saul Slash Hudson, best known as the lead guitarist of Guns N Roses. So for you, OLD_TEXT = '\\' and NEW_TEXT = '\/'. In general slashes are quite special and must be handled as such. But you can't just go around typing slashes and expecting things to work as expected be taken literally while using them as separators at the same time. This is where you must use forward slashes as separators.įor your case OLD_TEXT = '\' and NEW_TEXT = '/'. ![]() The trailing 'g' just says to replace all occurrences on a given line, not just the first.Īnd of course you need to separate the 's', the 'g', the old, and the new from each other. The leading 's' just tells it to search for OLD_TEXT and replace it with NEW_TEXT. The sed command in this case is 's/OLD_TEXT/NEW_TEXT/g'. ![]() ![]() $ echo "C:\Windows\Folder\File.txt" | sed -e 's/\\/\//g' Proposed GOP cuts would slash 30 billion from veterans spending. ![]()
0 Comments
Leave a Reply. |