1
我正在使用grep -f patternfile inputfile
,我想從圖案文件中輸出行號。例如,如果patternfile
是grep -f:印刷圖案行號
abc
def
和inputfile
是
abcx
abcy
defx
我想是這樣
1 abcx
1 abcy
2 defx
,其中1對應於ABCX和abcy的事實是,從1號線的匹配patternfile
,以及2對應於defx與patternfile
的第2行匹配的事實。有任何想法嗎?