Citate от man sed
:
If no -e, --expression, -f, or --file option is given, then the first non-option argument is taken as the sed script to interpret. All remaining arguments are names of input files; if no input files are specified, then the standard input is read.
s/regular expression/replacement/flags
The value of flags in the substitute function is zero or more of the following:
- N Make the substitution only for the N'th occurrence of the regular expression in the pattern space.
- g Make the substitution for all non-overlapping matches of the regular expression, not just the first one.
- p Write the pattern space to standard output if a replacement was made. If the replacement string is identical to that which it replaces, it is still considered to have been a replacement.
- w file Append the pattern space to file if a replacement was made. If the replacement string is identical to that which it replaces, it is still considered to have been a replacement.
Так что find / -maxdepth 3 -type f -print0 | xargs -0 sed -e 's/[tT][eE][sS][tT][sS][tT][rR][iI][nN][gG]1/itworked!/g' -i
будет работать так, как вы хотите.
Если вам не нравится уродливый шаблон для нечувствительных к регистру совпадений, вы можете использовать perl вместо sed: find / -maxdepth 3 -type f -print0 | xargs -0 perl -pe 's/teststring1/itworked!/ig' -i