我希望获得第2列,第7列和第8列的独特组合
IGA US TESTFEEDSystem memory2255935216
它应该显示文件的整行
以下是一些示例数据
C|IGA US TESTFEED|bld-af-y1-dhe.boulder.ibm.com|02/21/2016|00:02:31||System memory|2255935216|4294967295|4294967295|300
C|IGA US TESTFEED|bld-af-y1-dhe.boulder.ibm.com|02/21/2016|00:04:21||MEMPOOL_DMA|75432384|260292160|260215120|300
C|IGA US TESTFEED|bld-af-y1-dhe.boulder.ibm.com|02/21/2016|00:04:27||MEMPOOL_GLOBAL_SHARED|352552672|4294967295|4294967295|300
C|IGA US TESTFEED|bld-af-y1-dhe.boulder.ibm.com|02/21/2016|00:07:31||System memory|2255935216|4294967295|4294967295|300
C|IGA US TESTFEED|bld-af-y1-dhe.boulder.ibm.com|02/21/2016|00:09:15||MEMPOOL_DMA_ALT1|63314848|272409696|272409600|300
C|IGA US TESTFEED|bld-af-y1-dhe.boulder.ibm.com|02/21/2016|00:09:21||MEMPOOL_DMA|75432384|260292160|260215120|300
C|IGA US TESTFEED|bld-af-y1-dhe.boulder.ibm.com|02/21/2016|00:09:27||MEMPOOL_GLOBAL_SHARED|352552672|4294967295|4294967295|300
答案 0 :(得分:2)
我认为这会像你问的那样做。
perl -aF'\|' -ne 'print if "@F[1,6,7]" eq "IGA US TESTFEED System memory 2255935216"' myfile.txt
C|IGA US TESTFEED|bld-af-y1-dhe.boulder.ibm.com|02/21/2016|00:02:31||System memory|2255935216|4294967295|4294967295|300
C|IGA US TESTFEED|bld-af-y1-dhe.boulder.ibm.com|02/21/2016|00:07:31||System memory|2255935216|4294967295|4294967295|300
答案 1 :(得分:0)
x="IGA US TESTFEED";
y="System memory";
z="2255935216";
grep ".*|$x|.*|.*|.*|.*|$y|$z|.*" file