Skip to content

Instantly share code, notes, and snippets.

@tricker
Created April 18, 2012 16:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tricker/2414640 to your computer and use it in GitHub Desktop.
Save tricker/2414640 to your computer and use it in GitHub Desktop.
Simple csv file parser, takes infile, adds a time where appropriate, writes to outfile. All should reside in the same directory.
#!/usr/bin/perl
open INFILE, "fin2_tran.csv" or die $!;
open OUTFILE, ">fin2_out.csv" or die $!;
while (<INFILE>) {
s/,(\d{4}-\d{2}-\d{2})(,[^,]+$)/,"$1 11:00:00"$2/;
print OUTFILE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment