Stream Editor - Special Characters


Some of the useful SED special characters are as follows.
NOTE:-address1 and address2 are the starting and the ending addresses respectively.

Command Description
= Command the = command deals with line numbers.
& Command The & command supports the special character &.

Examples

\\Example of = command
$ sed '=' lfc.txt 
1
1) The Shadow of the Wind,  Carlos Ruiz Zafón
2
2) One Hundred Years of Solitude,  Gabriel García Márquez 
3
3) The Little Prince ,  Antoine de Saint
4
4) The Alchemist, Paulo Coelho 
------------------
------------------
\\Example of & command
$ sed 's/[[:digit:]]/Book number &/' lfc.txt
Book number 1) The Shadow of the Wind,  Carlos Ruiz Zafón
Book number 2) One Hundred Years of Solitude,  Gabriel García Márquez 
Book number 3) The Little Prince ,  Antoine de Saint
Book number 4) The Alchemist, Paulo Coelho 






Visit :


Discussion



* You must be logged in to add comment.