I am trying to remove single quotes and double quotes from a file. Can I do it in a single sed command?
I am trying :
sed \'s/\\\"//g;s/\\\'//g\' tx
To remove single quotes, simply use double quotes for the regex in sed
:
sed -e "s/'//g" ./new_file.csv
Another possibility would be to use tr
:
tr -d \'\" file
I solved it (in Centos 7
) by removing surrounding quotes all together like:
sed -i s/\'//g file;sed -i s/\"//g file
You can use commands below
sed "s/'/ /g" file.txt > newfile.txt
sed 's/\"//g' newfile.txt > Required_file.txt
Required_file.txt
is the final output.
You cannot escape a single quote inside a pair of singe quotes in shell. Escaping double quotes is allowed though. Following sed command should work:
sed "s/['\"]//g" file
Try this one instead :
sed -e 's|["'\'']||g' txt