11

FreeBSD で特定のパターンで始まる行の単語を置き換えるにはどうすればよいですか? 次のファイルの内容を考慮してください。

this is to test 
that was for test

「this」で始まる行の「test」を置き換えたい。

4

2 に答える 2

1

インプレースで変更するには、次のコマンドを使用します。

sed -i '/^this/ s/test/something/g' inputfile;
于 2016-01-14T09:46:23.010 に答える