grep就ok了,加上-E参数:
示例:
bsstest2:/billing/app/user/xufc/test$grep -E "^Pre-depends:|^Depends:|^Filename:" info.txt
Filename: pool/main/2/2vcard/2vcard_0.5-3_all.deb
你给的文件中只有一个Filename开头的,所以只有一个结果
下面我换个搜索条件,显示可能会更加清晰:
bsstest2:/billing/app/user/xufc/test$grep -E "^Section:|^Version:|^Filename:" info.txt
Section: utils
Version: 0.5-3
Filename: pool/main/2/2vcard/2vcard_0.5-3_all.deb
bsstest2:/billing/app/user/xufc/test$
其中info.txt就是你给的示例文件