Linux 經常使用命令 從文件中搜索關鍵字並顯示行數(cat,grep函數)

假若有test1.txt的格式以下圖所示:spa 有test2.txt的內容以下:code 現需將test2.txt含有的關鍵字的行搜索出來並顯示行數blog 則能夠用到命令:ci 1table cat test1.txt | grep -nf test2.txt #-n 表示找到匹配以後,輸出匹配所在行數class   運行後,效果以下:test 36840733和36909134表示含有這兩個
相關文章
相關標籤/搜索