Skip to content

Instantly share code, notes, and snippets.

@soh-i
Created September 20, 2012 09:01
Show Gist options
  • Save soh-i/3754778 to your computer and use it in GitHub Desktop.
Save soh-i/3754778 to your computer and use it in GitHub Desktop.
Numbers.appの変なCSVをまともなTSVにエクスポートする
#!/usr/bin/env perl -w
use strict;
# Convert CSV file that exported by Apple Numbers.app to TSV
my $file = shift || die;
open my $fh, '<', $file || die;
while ( my $entry = <$fh> ) {
#たくさん","ができるので消した.
if ( $entry =~ s/,{7}//g ) {
#なんか行頭にも","がくっついたのと最初行の"#"も消した
if ( $entry =~ s/^\,{1}|^\#\,//g ) {
# to tsv
if ( $entry =~ s/\,/\t/g ) {
print $entry;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment