in reply to Combine files with same extension in new file
#!/usr/bin/perl use warnings; use strict; open my $OUT, '>', 'output.txt' or die "output.txt: $!"; for my $file (glob '*.txt') { open my $FH, '<', $file or die "$file: $!"; while (<$FH>) { print {$OUT} $_ unless 1 == $.; } } close $OUT or die $!;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Combine files with same extension in new file
by AhmedABdo (Acolyte) on Oct 01, 2015 at 10:22 UTC | |
by choroba (Cardinal) on Oct 01, 2015 at 10:28 UTC | |
by AhmedABdo (Acolyte) on Oct 01, 2015 at 10:38 UTC | |
by choroba (Cardinal) on Oct 01, 2015 at 11:15 UTC | |
by AhmedABdo (Acolyte) on Oct 01, 2015 at 12:27 UTC | |
by Anonymous Monk on Jul 17, 2019 at 14:31 UTC |