用sed 给文本文件加行号
生活随笔
收集整理的這篇文章主要介紹了
用sed 给文本文件加行号
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
看例子:
[root@localhost tmp]# sed '=' test.txt 1 tsttst tsttsttst 2 west gao 3 west abces [root@localhost tmp]# sed = test.txt | sed 'N;s/\n/\t/' 1 tsttst tsttsttst 2 west gao 3 west abces [root@localhost tmp]#
N的解釋:
N:Add a newline to the pattern space, then append the next line of input to the pattern space. If there is no more input then sed exits without processing any more commands.
轉載于:https://www.cnblogs.com/gaojian/archive/2013/01/09/2853406.html
總結
以上是生活随笔為你收集整理的用sed 给文本文件加行号的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 驴多少钱一头啊?
- 下一篇: 亚龙湾热带天堂森林公园好玩吗