0

我运行了下面的 gzgrep 命令。它显示文件名后跟冒号和搜索结果。有时文件名不会出现在搜索结果中。我需要修改命令以使文件名始终位于搜索结果的首位。使用 solaris 10 和 korn shell。

> gzgrep  3337678895 /home/tst02/WWSD.????.20121123.????.BLB4.????.*.gz
/home/tst02/WWSD.0142.20121123.1145.BLB4.BMA1.scr.mma.20121123_225100.gz:1A010130888236898002B010642012112311390003201211231139030262012112311392901020121123113929C01075001009260511300414141510092605113004141415100926051130041414131009260511300D0100202E01015092882368009999F0101206CAN2PB0004K0100200L0100501600N0101700225103337678895P01002NNQ01004GLB4R01009YNNNNNNYNR02007Y152801



> gzgrep 3564767  /home/tst01/FEL??_R20121101070001_prig_*.gz
2012110107582420121101075911010349504230298062459      0419887344          000000004704230242349500190298062459                                                                                                00480333495001  AA40512C804C036C0048033C036C0048033C21101C00000C0200000C0C0C0C000C010C00298062459CFFFFFFFFFFFFFF1C010C    00419887344C      FFFFFFFFFF0758244C000000464C00000C00000C000C0000000000000C00000C00000C14560C                                                                                                                                                                                                                  042C3564767C                                                                071C101C0C00016C                                                                                                                                    134950019C204230242C                                                                                                   
4

1 回答 1

0

GNU grep has the -H option:

   -H, --with-filename
          Print the file name for each match.  This is  the  default  when
          there is more than one file to search.

Maybe this also works with gzgrep.

于 2013-01-07T11:40:11.833 回答