我的理解是读取第一行并且以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' 命令
原文:http://www.cnblogs.com/uxiuxi/p/7253965.html