-i,--in-place オプションを使う.
$ cat a.txt
abc123
$ sed -i 's/123/XYZ/' a.txt
$ cat a.txt
abcXYZ
サフィックスを指定すると元のファイルのバックアップを作成した上で元のファイルを書き換える:
$ cat a.txt
abc123
$ sed --in-place=.old 's/123/XYZ/' a.txt
$ cat a.txt a.txt.old
abcXYZ
abc123
Go to list of users who liked
Share on X(Twitter)
Share on Facebook
More than 5 years have passed since last update.
-i,--in-place オプションを使う.
$ cat a.txt
abc123
$ sed -i 's/123/XYZ/' a.txt
$ cat a.txt
abcXYZ
サフィックスを指定すると元のファイルのバックアップを作成した上で元のファイルを書き換える:
$ cat a.txt
abc123
$ sed --in-place=.old 's/123/XYZ/' a.txt
$ cat a.txt a.txt.old
abcXYZ
abc123
Register as a new user and use Qiita more conveniently
Go to list of users who liked