Citate:
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
は動作します。
あなたは大文字小文字を区別しないマッチのための醜いパターンが気に入らない場合は、代わりのsedのPerlを使用することができます(!)find/-maxdepth 3 -type f -print0 | xargs -0 perl -pe 's/teststring1/itworked!/ig' -i
シェルは、感嘆符を解釈され、それなしでみては? – ismail
ok今のところ試してみると、結果は数分で更新されます – user1166981
なぜ/ tmpに変わるのか、あなたのfindコマンドは '/'を使ってあなたの検索をルートディレクトリに固定します。/tmpが検索されますが、/ tmp以下(あなたの-maxdepth 3)を検索するつもりなら、 'cd/tmp;見つける。 -maxdepth ... 'またはより簡単に' find/tmp -maxdepth ... '、初期の' cd/tmp; 'はありません。がんばろう。 – shellter