daily pastebin goal

Convert TSV to CSV

sweenig Jan 3rd, 2014 2,112 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
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand