in reply to Re: Handling japanese file & comparison
in thread Handling japanese file & comparison
#!/usr/bin/perl use strict; my $f = "vc_20151003_1.zip"; my $cat = "5426085.csv"; my $file = $f; my $file =~ s/.zip/.csv/; ## Read the cat file into hash %catHash = (); open(CAT, $cat) || die "$cat couldn't be opened\n"; while(<CAT>) { @line = split /,/; $catHash{$line[1]}++; } close(CAT); open(OUT, ">".$file) || "$file couln't be opened for write\n"; open(IN,sprintf("zcat %s |", $f)) || die "Could not open pipe for $f +: $!"; while(<IN>) { chomp; my @line = split /\t/; $line[17] =~ s/^0+//; $line[14] =~ s/^0+//; if(exists($catHash{$line[17]}) || exists($catHash{$line[14]})) + { print OUT join("\t", @line) . "\n"; } else { next; } } close(IN); close(OUT);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Handling japanese file & comparison
by CSharma (Sexton) on Oct 05, 2015 at 13:39 UTC |