MCQ Practice

Which command is used to replace word 'cat' (already present in the file) with 'mouse' at all places in a file 'old.txt' and save the result in a new file 'new.txt'?

A

sed 's/cat/mouce/g' old.txt > new.txt

B

sed 's/cat/mouse' old.txt new.txt

C

sed '/s/cat/mouse/g' old.txt new.txt

D

sed '/s/cat/mouse' old.txt > new.txt

Correct Answer: A