如何在grep输出中删除文件名(awk,sed)?

时间:2013-10-15 11:43:26

标签: sed awk grep

你好我有grep的输出

cc.log.1:<Operation adaptorMethod="search" adaptorName="Search" status="Success"/>
cc.log.12:<Operation adaptorMethod="getOrderId" adaptorName="PersistenceAdaptor" status="Success"/>

我需要从开头剪切文件名,只留下标签

我尝试了awk '/<Operation/,/>$/' sed -n '/^<Ope/,/>$/p'等的几种变体

但没有成功。有谁可以帮助我?

1 个答案:

答案 0 :(得分:2)

您不需要sedawkcut只需要-h的{​​{1}}选项:

-h, --no-filename

Suppress  the  prefixing of file names on output.  This is the default when 
there is only one file (or only standard input) to search.