とりあえず,以下で簡易的には取れる. #!/usr/bin/perl # INPUT $cabocha -f1 -O1 test.txt > test2.txt # INPUT $cabocha -f1 -O2 test.txt > test2.txt $input = &argcut($ARGV[0]); open(INPUT, "$ARGV[0]") or die "cant open $ARGV[0]"; open(OUT,">$input") or die "cant open $ARGV[0]"; $aster; $line; while(<INPUT>){ chomp; if(/^EOS/){ $line++; print "$line"."="."$aster\n"; $aster = 0; } elsif(/^\*/){ $aster++; } }