Frequent Question: How Do I Remove Double Quotes in Unix?
Contents How Do You Remove Double Quotes in Linux? 2 Answers Sed ‘S/”//G’ Removes All Double Quotes on Each Line. Sed ‘S/^/”/’ Adds a Double-Quote at the...
Contents
How do you remove double quotes in Linux?
2 Answers
- sed ‘s/”//g’ removes all double quotes on each line.
- sed ‘s/^/”/’ adds a double-quote at the beginning of each line.
- sed ‘s/$/”/’ adds a double-quote at the end of each line.
- sed ‘s/|/”|”/g’ adds a quote before and after each pipe.
- EDIT: As per the pipe separator comment, we have to slightly change the command.
Must Read
How do you replace a double quote in Unix?
Just use ” for the outer quotes in your sed and you can then use ‘ in the replacement. You don’t want “+ unless you might have more than one consecutive ” and you want to replace all of them. If you do, use sed -r “s/\”+/\’/g” .