博客园 首页 联系 订阅 管理

2015年9月9日

摘要: 流程控制一般情况下,sed是将编辑命令从上到下依次应用到读入的行上,但是像d/n/D/N命令都能够在一定程度上改变默认的执行流程,甚至利用N/D/P三个命令可以形成一个强大的循环处理流程。除此之外,其实sed还提供了分支命令(b)和测试(test)两个命令来控制流程,这两个命令可以跳转到指定的标签(... 阅读全文
posted @ 2015-09-09 19:57 范云龙 阅读(1384) 评论(0) 推荐(0)

摘要: $cat textfind the Match statementConsult the Get statementusing the Read statement to retrieve data/the .* statement/{hs/.*the \(.*\) statement.*/\1/y... 阅读全文
posted @ 2015-09-09 19:39 范云龙 阅读(444) 评论(0) 推荐(0)

摘要: cat text121122111222$sed '/1/{H;$!d};$p;$x' text222222111111$sed '/2/{H;$!d};$x' text111111222222$sed 'H;$!d;${x;s/^\n//;s/\n/,/g}' text1,2,11,22,111,... 阅读全文
posted @ 2015-09-09 19:11 范云龙 阅读(162) 评论(0) 推荐(0)