Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4733823
  • 博文数量: 930
  • 博客积分: 12070
  • 博客等级: 上将
  • 技术积分: 11448
  • 用 户 组: 普通用户
  • 注册时间: 2008-08-15 16:57
文章分类

全部博文(930)

文章存档

2011年(60)

2010年(220)

2009年(371)

2008年(279)

分类:

2008-11-16 20:31:00

zj@zj:~/Script/cushell/08.11.15$ cat sed.data
test1
1
11
test2
2
22
test3
3
33
test4
4
44

zj@zj:~/Script/cushell/08.11.15$ sed -n '/test/{:l;N;/test/{p;s/.*//};$!bl}' sedsed -n '/test/{p;:a;n;p;/test/q;b a}' sed.data
test1
1
11
test2

zj@zj:~/Script/cushell/08.11.15$ sed -n '/test/{n;:a;p;n;/test/q;b a}' sed.data
1
11

zj@zj:~/Script/cushell/08.11.15$ sed -n '/test/{:l;N;/test/{s/^\n//;p;s/.*//};$!bl}' sed.data
test1
1
11
test2
2
22
test3
3
33
test4

自己体会区别去把,累了,难得写了.

阅读(1333) | 评论(0) | 转发(0) |
0

上一篇:stty使用

下一篇:自己写c strlen函数

给主人留下些什么吧!~~