我有一个包含以下内容的文本文件。
NewFile1.txt
Targets:
target1
target2
target3
.......
Build Configurations:
config1
config2
config3
.......
Schemes:
schemeName1
schemeName2
schemeName3
...........
...........
我想解析文件并提取所有方案并放入列表中。我怎样才能获得这个shell脚本?
这是awk的单行解决方案。
awk 'p && NF {print;} /Schemes:/ {p=1}' NewFile1.txt
schemeName1
schemeName2
schemeName3
请 照看网上的“ awk vs sed”,您会发现在大多数情况下,awk会比sed更方便。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句