请问用SED如何在四个由aaaaaa和dddddd构成的区间内得到指定的第1个和第3个区间呢?复制代码
- aaaaaa
- cccccc
- dddddd
- aaaaaa
- eeeeee
- dddddd
- aaaaaa
- bbbbbb
- dddddd
- aaaaaa
- ffffff
- dddddd
谢谢解答先。复制代码
- aaaaaa
- cccccc
- dddddd
- aaaaaa
- bbbbbb
- dddddd
复制代码
- gawk "{if($0~/dddddd/)$0=$0\"\n\"}1" a.txt | gawk -v RS= "/aaaaaa/{n++;if(n==1||n==3)print}"
欢迎光临 批处理之家 (http://bbs.bathome.net/) | Powered by Discuz! 7.2 |