#!/usr/bin/perl open (file,"D:\\OUTCAR"); $a=0; while ($lines=<file>){ if ($lines=~/TOTAL ELASTIC/){ $lines_number=$.; $a=1 } if ($a==1){ sub1() } } close(file); sub sub1{ if (grep {$.==$_}$lines_number..$lines_number+10){ print "$lines"; }else{ $a=2; } }
请发表评论