I'm trying to replace a string with another in all files in dir. Trying to use this command

 sed 's/foo/bar/' *

But it replaces foo and not fOo or Foo and others.

how to find "foo" case-INsensitively?


With some sed implementations like GNU's or FreeBSD's:

sed 's/foo/bar/i' ./*

The i makes what you need.

If your sed doesn't support that non-standard extension, you can always do:

sed 's/[fF][oO][oO]/bar/' ./*

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.