要查找查log文件带有“Capabilities-Exchange”字符串的行,并打印它的前5行和后5行

awk '{a[NR%5]=$0}/Capabilities-Exchange/{print "******************************************************";\

for(i=NR-4;i<=NR;i++ ) if(i>0) print a[i%5];i=0;while(i<5 && getline){print;i++ }}' ./test.log

相关文章:

  • 2021-08-25
  • 2021-05-23
  • 2021-11-30
  • 2022-12-23
  • 2021-06-21
  • 2021-09-25
  • 2021-11-30
猜你喜欢
  • 2021-11-30
  • 2021-10-05
  • 2021-09-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-20
相关资源
相似解决方案