Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- use strict;
- use warnings;
- use Getopt::Long ();
- Getopt::Long::Configure( 'bundling' );
- my %OPTS;
- Getopt::Long::GetOptionsFromArray( \@ARGV,
- 'a=s' => \$OPTS{A},
- 'b=s' => \$OPTS{B},
- ) or die("Bad options");
- open( my $orig, '<', $OPTS{A} )
- or die("Open file-A failed: $!");
- open( my $new, '<', $OPTS{B} )
- or die("Open B failed: $!");
- my %SEEN;
- while (<$orig>) {
- chomp;
- next if( length($_) < 1 );
- $SEEN{$_} = 1;
- }
- close($orig);
- while(<$new>) {
- chomp;
- next if( length($_) < 1);
- next if( exists $SEEN{$_} );
- $SEEN{$_} = 1;
- printf("%s\n", $_);
- }
- close($new);
RAW Paste Data