2014년 7월 27일 일요일

텍스트 파일 병합 펄 스크립트

$name = "name.txt"; $formular = "formular.txt"; $A = "A.txt"; $B = "B.txt"; $C = "C.txt"; open $fh_name, '<', $name or die "Cannot open $name: $!"; open $fh_formular, '<', $formular or die "Cannot open $formular: $!"; open $fh_A, '<', $A or die "Cannot open $A: $!"; open $fh_B, '<', $B or die "Cannot open $B: $!"; open $fh_C, '<', $C or die "Cannot open $C: $!"; open $table, '>table.txt'; my $n = @{[<$fh_name>]}; seek $fh_name,0,0; for ($i=1; $i<= $n; $i++){ $l_name = <$fh_name>; chomp($l_name); $l_formular = <$fh_formular>; chomp($l_formular); $l_A = <$fh_A>; chomp($l_A); $l_B = <$fh_B>; chomp($l_B); $l_C = <$fh_C>; chomp($l_C); print $table "$l_name\t$l_formular\t$l_A\t$l_B\t$l_C\n"; }

댓글 없음:

댓글 쓰기