码迷,mamicode.com
首页 > 其他好文 > 详细

sed 'N' 命令

时间:2017-07-29 11:36:31      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:int   efault   www.   mit   append   pac   att   and   rate   

我的理解是读取第一行并且以new line character \n为分割符 附加到第一行, 之后在处理第二行(最开始的第三行)。 

http://www.thegeekstuff.com/2009/11/unix-sed-tutorial-multi-line-file-operation-with-6-practical-examples/#comments

这篇文章写得特别好。

  • The curly braces “{” and “}” used to group the commands. The curly braces and sed commands must be on the seperate lines.
  • Sed reads the first line and place it in the pattern space, N command reads the next line and appends with the pattern space i.e first line seperated by newline. So now pattern space will have firstline\nsecondline.
  • Next substitution of \n to space@space and it prints the pattern space content as its sed default behaviour. So consecutive lines are joined and delimited by ” @ “

sed 'N' 命令

标签:int   efault   www.   mit   append   pac   att   and   rate   

原文地址:http://www.cnblogs.com/uxiuxi/p/7253965.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!