sweenig

Convert TSV to CSV

Jan 3rd, 2014
2,218
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/perl
  2. open (INFILE, @ARGV[0]);
  3. my $line;my @thelines;my $thecounter=0;
  4. while (<INFILE>) {
  5.     chomp;
  6.     $line = $_;
  7.     $line =~ s/\t/,/g;
  8.     $thelines[$thecounter]=$line;++$thecounter;
  9. }
  10. close (INFILE);
  11. open (OUTFILE, ">@ARGV[0]");
  12. foreach (@thelines) {print OUTFILE "$_\n";}
  13. close (OUTFILE);
RAW Paste Data