1.

Which one of the following commands will be used to delete all the instances of string ‘manager’ in file003?(a) 1,$s/manager/ /g(b) %s/manager/director/g(c) 1,$s/professor/director(d) %s/manager/ /I have been asked this question during an online interview.I would like to ask this question from Commands for Searching, Replacing and Substituting in Vi Editor in section The Vi Editor of Unix

Answer»

The CORRECT OPTION is (a) 1,$s/manager/ /g

To explain: When the TARGET pattern is left empty, then all the instances of the source pattern are deleted within the addressed lines in the file.



Discussion

No Comment Found

Related InterviewSolutions