% cat hoge.txt
aaa aaa
bbb
aaa
% perl -i -p -e 's/aaa/ccc/g' hoge.txt
% cat hoge.txt
ccc ccc
bbb
ccc