>>2668 a-jmj こんな感じでしょうか。 open(IN,"file"); while (<IN>){ chomp; local($date) = (split /<>/)[0]; push(@{$line_{$date}}, $_); } close(IN); foreach $date (sort keys %line_ ){ foreach (@{$line_{$date}}){ print "$_ "; } print "\n"; } 実行結果: 1<>aaaa<> 1<>bbbb<> 2<>cccc<> |