1.

Which one of the following command is used for replacing | with : globally?(a) sed‘s/|/:/’ emp.lst(b) sed ‘/|/:/’ emp.lst(c) sed‘s/|/:/g’ emp.lst(d) sed ‘s/I have been asked this question in a national level competition.I want to ask this question from sed command topic in portion Filters using Regular Expressions of Unix

Answer»

Right choice is (C) SED‘s/|/:/g’ emp.lst

Easiest explanation: sed can perform SUBSTITUTION i.e. it allows us to replace a pattern in its input with some other pattern. The FLAG g is used for performing substitution globally.



Discussion

No Comment Found

Related InterviewSolutions