Linux OS Editors Question:

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

Linux Editors Interview Question
Linux Editors Interview Question

Answer:

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


Previous QuestionNext Question
Which command will delete all the blank lines in file old.txt?
a) sed '/d' old.txt
b) sed '/^/d' old.txt
c) sed '/^$/d' old.txt
d) sed '/^*/d' old.txt
Which sed command deletes the specified address range:
a) [address range]/s
b) [address range]/p
c) [address range]/d
d) [address range]/y