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?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityI'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/' ./*