1

Find and replace text within multiple files

I found the above answer for finding and replacing regular strings, but it doesn't work with say replacing "none" with "Unitless" due to the syntax of the command.

Is there any way around this?

3

The easiest solution is to change the outer quotes to single quotes:

sed 's/"none"/"Unitless"/g'

IMHO it's better to use single-quotes anyhow for literal strings - unless you need the double quote functionality specifically (for example, when using a shell variable in the pattern or replacement text).

Alternatively, escape the literal quotes: "s/\"none\"/\"Unitless\"/g"

  • @ThomasKirven If this answer solved your issue, please take a moment and accept it by clicking on the check mark to the left. That will mark the question as answered and is the way thanks are expressed on the Stack Exchange sites. – dessert May 22 '19 at 7:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.