Shell Interview Questions and Answers

 

Use sed command to replace the content of the file (emulate tac command)
Eg.
if cat file1

ABCD
EFGH
Then O/p should be
EFGH
ABCD

sed '1! G; h;$!d' file1

Here G command appends to the pattern space,
h command copies pattern buffer to hold buffer
and d command deletes the current pattern space.

Posted by:Richards