#script for i in `zgrep -l $1 PSAATL11*` do for j in `zgrep -n $1 $i | awk -F ':' '{print $1}'` do ((k=j+1)); m=$(zcat $i | sed -n ${j},${k}p); echo $m; #echo $m |awk -F ' ' '{print $5}'; done done #指定行数语法点: sed -n <start_line_num>,<end_line_num>p file #输出分割后字段语法: awk -F '<delimitor>' '{print $num}' #变量增减 ((j=j+1)) #for 循环 for i in .... do xxx done