Skip to content

Instantly share code, notes, and snippets.

@punytan
Created April 16, 2010 20:56
Show Gist options
  • Save punytan/368965 to your computer and use it in GitHub Desktop.
Save punytan/368965 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use utf8;
use Encode;
open (my $in, '<', 'source.csv') or die $!;
my @csv = <$in>;
close $in or die $!;
my $email = '[email protected]';
my @data;
for (@csv) {
my $line = decode_utf8 $_;
my @column = split /,/, $line;
push @data, $line unless ($column[0] eq $email);
}
open (my $out, '>', 'output.csv') or die $!;
for (@data) {
print {$out} encode_utf8($_);
}
close $out or die $!;
__END__
[email protected] example hoge.com
[email protected] example example.com
[email protected] fuga example.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment