dry run
Without any option, running sed doesn't update files. So, normal mode is dry run mode.
dry run with diff
sed 's/hoge/fuga/g' sample.txt | diff sample.txt -
dry run with beauty diff
sed 's/hoge/fuga/g' sample.txt | diff --color -u sample.txt -
update file
-i
(--in-place)
sed -i 's/hoge/fuga/g' sample.txt
update with backup
sed -i.bak 's/hoge/fuga/g' sample.txt
use multiple orders
sed -e 's/hoge/fuga/g' -e 's/xxxx/aaaa/g' sample.txt
Top comments (0)