Have you tried this
# cat a.txt
1,2,3,WORKSTATION1\A,5
1,2,3,WORKSTATION2\B,5
1,2,3,WORKSTATION1\C,5
1,2,3,WORKSTATION1\D,5
1,2,3,WORKSTATION1\E,5
1,2,3,WORKSTATION1\F,5
1,2,3,WORKSTATION1\G,5
# sed -e 's/\\/,/g' a.txt
1,2,3,WORKSTATION1,A,5
1,2,3,WORKSTATION2,B,5
1,2,3,WORKSTATION1,C,5
1,2,3,WORKSTATION1,D,5
1,2,3,WORKSTATION1,E,5
1,2,3,WORKSTATION1,F,5
1,2,3,WORKSTATION1,G,5
To replace single quotes ('
) it's easiest to put the sed command within double quotes and escape the double quote in the replacement:
$ cat quotes.txt
I'm Alice
$ sed -e "s/'/\"/g" quotes.txt
I"m Alice
Note that the single quote is not special within double quotes, so it must not be escaped.
If, instead one wants to replace backticks (`
), as the question originally mentioned, they can be used as-is within single quotes:
$ cat ticks.txt
`this is in backticks`
$ sed -e 's/`/"/g' ticks.txt
"this is in backticks"
Within double quotes, you'd need to escape the backtick with a backslash, since otherwise it starts an old-form command substitution.
See also:
Best Answer
find
+ GNUsed
solution:"*.[ch]"
- wildcard to find files with extension.c
or.h
-i
: GNUsed
extension to edit the files in-place without backup. FreeBSD/macOSsed
have a similar extension where the syntax is-i ''
instead./^#include /
- on encountering/matching line which starts with pattern:#include
s|\\|/|g
- substitute all backslashes\
with forward slashes/
(\
escaped with backslash\
for literal representation).