I am using this command to find and replace strings in files.
find . -name "dog.*" -exec sed -i "s/dog/cat/Ig" {} +
It works fine for exact case match, but I want it to be case insensitive. I used I
but it doesn't seem to be working. How can I fix this? I simply want to be able to replace the strings using a simple one-liner. The name of the files are dog with different extensions and I want to replace all incidents of dog with cat regardless of case.
Update: I have tried both lowercase and uppercase I
but still not working. I have also tried it with gsed.
I have just realized something that I wonder may be the root cause of this issue. The case where it is not doing the replacement is when my keyword is part of a string. It will replace all instances of dog but if there is something like dog_food
, it will not do the replacement.