Jump to content

User:Rich Farmbrough/temp214

From Wikipedia, the free encyclopedia
  1. perl sub length
  2. pipe in something like (grep -n "sub " <file>;wc <file>)

while(<>){

  chomp;
  if (/(\d+):sub +([^ ]+)/){
      $sub=$2;
      $line=$1;
  }
  elsif (/^ (\d+)/){
      $line=$1;
  }
  if ($oldsub) {
     print  $line-$oldline."\t\t$oldsub\n";
  }
  $oldsub=$sub;
  $oldline=$line;

}