Thursday, March 23, 2017

Bash: sed - part IX


Listing lines.

The list command (l) allows you to print both the text and nonprintable characters in a data stream.

# od -c data6a.txt


0000000   T   h   i   s  \t       i   s  \t       l   i   n   e  \t
0000020   n   u   m   b   e   r  \t       1   .  \n   T   h   i   s  \t
0000040       i   s  \t       l   i   n   e  \t       n   u   m   b   e
0000060   r  \t       2   .  \n   T   h   i   s  \t       i   s  \t
0000100   l   i   n   e  \t       n   u   m   b   e   r  \t       3   .
0000120  \n   T   h   i   s  \t       i   s  \t       l   i   n   e  \t
0000140       n   u   m   b   e   r  \t       4   .  \n








# sed -n 'l' data6a.txt

This\t is\t line\t number\t 1.$
This\t is\t line\t number\t 2.$
This\t is\t line\t number\t 3.$
This\t is\t line\t number\t 4.$

No comments:

Post a Comment