1.

Which one of the following command will be used for quitting after selecting 3 lines from file emp.lst?(a) sed -n 3 emp.lst(b) sed -i 1-3 emp.lst(c) sed ‘3q’ emp.lst(d) sed -nThis question was posed to me during an online exam.Enquiry is from sed command topic in chapter Filters using Regular Expressions of Unix

Answer»

Right CHOICE is (c) sed ‘3q’ emp.lst

Easy EXPLANATION: We can use line addressing feature of sed command by using ‘q’ ALONG with the line number. For example, 3q will QUIT after selecting 3 lines from the file. Here ‘q’ is used for QUITTING.



Discussion

No Comment Found

Related InterviewSolutions