in reply to Merging of files with some edit.
This appears to work correctly. Tested with four files.
#!/usr/bin/perl use warnings; use strict; @ARGV > 1 or die "usage: $0 <<MAIN_LIB_FILE>> <<LIB_FILE_FOR_MARGE>> +\n\n"; open my $OUT, '>', 'final_file.dat' or die "Cannot open 'final_file.da +t' because: $!"; while ( <> ) { if ( /^\}$/ .. /^\s+.*\{$/ ) { print $OUT $_ if /^\s+.*\{$/; next; } print $OUT $_; } print $OUT "}\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Merging of files with some edit.
by anirbanphys (Beadle) on Jun 26, 2019 at 05:42 UTC |