Skip to content

Instantly share code, notes, and snippets.

@punytan
Created April 16, 2010 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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 = 'example@example.com';
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__
example@hoge.com example hoge.com
fuga@example.com fuga example.com
example@hoge.com example hoge.com
example@example.com example example.com
fuga@example.com fuga example.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment