Loading ...
Sorry, an error occurred while loading the content.

Help with date format

Expand Messages
  • joach@direct.ca
    I have been working with file which have the date as 20000903 and I wish then to read 03092000 I would think that this would have to be split and YYYY=4
    Message 1 of 1 , Sep 3, 2000
    • 0 Attachment
      I have been working with file which have the date as 20000903 and I
      wish then to read 03092000
      I would think that this would have to be split and YYYY=4 fields from
      the left ..... and something similar for the MM and DD....... this is
      the format I would like to use..... because it would allow edits of
      other data like 2000-09-03 and 2000 09 03 or 2000/09/03 into a
      format I could use.

      My data looks like

      200000830,5151,5645,874.6547
      200000831,987,4568,5557,1542
      200000901,6546,1695,6515,5145
      200000902,4555,6546,654,5454
      200000903,6544,616,358,6854

      I would like to use it in a small script as below......

      #!/usr/bin/perl -w
      use strict;

      my $infile = shift;
      my $outfile = shift;

      open (IN, $infile) || die "can't open $infile: $!";
      open (OUT, ">$outfile")|| die "can't open $outfile: $!";

      while (<IN>) {
      chomp;

      #{ please enter sutiable lines to fit into this space }

      close (IN);
      close (OUT);

      __END__


      TIA

      John
    Your message has been successfully submitted and would be delivered to recipients shortly.