http://qs1969.pair.com?node_id=11108549


in reply to sed in perl

Why are you using sed when you can use Perl directly?

open my $fh1, '<', "file1" or die "Couldn't read 'file1': $!"; my %delete = map { s/\s*$//; $_ => 1 } <$fh1>; open my $fh2, '<', "file2" or die "Couldn't read 'file2': $!"; while( <$fh2>) { my( $key, $value ) = split /\s*=/; if( ! $delete{ $key }) { print $_; } else { # skip this key }; };

If you want to keep on using sed, my advice is to print all the commands you're launching and then inspecting them or running them from the command line separately.