用sed 给文本文件加行号
生活随笔
收集整理的這篇文章主要介紹了
用sed 给文本文件加行号
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
看例子:
[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.
轉(zhuǎn)載于:https://www.cnblogs.com/gaojian/archive/2013/01/09/2853406.html
總結(jié)
以上是生活随笔為你收集整理的用sed 给文本文件加行号的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 驴多少钱一头啊?
- 下一篇: IE8下的VML显示问题解决方案