1.

Which of the following commands can be used to replace ‘professor’ with ‘director’ throughout the whole file?(a) 1,$s/professor/director/g(b) %s/professor/director/g(c) 1,$s/professor/director(d) 1,$s/professor/director/g and %s/professor/director/gThis question was posed to me during an online exam.This is a very interesting question from Commands for Searching, Replacing and Substituting in Vi Editor topic in division The Vi Editor of Unix

Answer»

The correct option is (d) 1,$s/professor/director/G and %s/professor/director/g

The explanation: We can replace 1,$ with %. It will WORK same as 1,$. ‘g’ flag is USED for GLOBAL replacement.



Discussion

No Comment Found

Related InterviewSolutions