in reply to Comparision Utility PERL
#!/usr/bin/perl use strict; use warnings; use Inline::Files; my %col2file1; #use better name! while (<FILE1>) { next if /^\s*$/; #skip blank lines my $col2 = (split /\|/, $_)[1]; $col2 =~ s/^\s*//; #delete leading spaces $col2 =~ s/\s*$//; #delete trailing spaces $col2file1{$col2} = 1; } while (<FILE2>) { next if /^\s*$/; #skip blank lines my $col3 = (split /\|/,$_)[2]; $col3 =~ s/^\s*//; #delete leading spaces $col3 =~ s/\s*$//; #delete trailing spaces print if $col2file1{$col3}; } #prints: "AE|A|D|| " __FILE1__ L| D L| C L| C __FILE2__ AE|A|D|| A|A|P| | A|A|P| | A|A|P| |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Comparision Utility PERL
by vighneshmufc (Acolyte) on Feb 09, 2018 at 10:41 UTC | |
by vighneshmufc (Acolyte) on Feb 09, 2018 at 10:44 UTC | |
by Marshall (Canon) on Feb 09, 2018 at 11:30 UTC | |
by vighneshmufc (Acolyte) on Feb 09, 2018 at 11:51 UTC | |
by poj (Abbot) on Feb 09, 2018 at 12:37 UTC |