本文介绍了Sed:获取以某些前缀开头的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有Blackberry jad文件:
I have file Blackberry jad file:
RIM-COD-URL-12: HelloWorld-12.cod
RIM-COD-Size: 68020
RIM-MIDlet-Icon-2-1: ____HOVER_ICON_res/icon/blackberry/icon-68.png,focused
RIM-COD-URL-11: HelloWorld-11.cod
RIM-MIDlet-Icon-Count-2: 1
RIM-COD-URL-10: HelloWorld-10.cod
RIM-MIDlet-Icon-Count-1: 1
MIDlet-Vendor: Vasia Pupkin
RIM-MIDlet-Icon-1-1: res\icon\blackberry\____HOVER_ICON_icon-68.png,focused
Manifest-Version: 1.0
RIM-MIDlet-Flags-1: 0
RIM-COD-SHA1-38: 9a c8 b3 35 72 de 34 5e 7a 0a 5b 9e c3 3a 65 4c 20 0f 8e 50
我只想让行以RIM-COD-
开头.
可以为我提供awk
或sed
的解决方案吗?
Can you provide me solutions for awk
or sed
?
推荐答案
使用sed -n
,仅打印与RIM-COD匹配的行.
Use sed -n
and only print lines that match RIM-COD.
sed -n -e '/^RIM-COD-/p' yourfile.txt
这篇关于Sed:获取以某些前缀开头的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!