#!/bin/perl
($sec,$min,$hour,$mday,$mon,$year,$wday, $yday,$isdst)=localtime(time);
$year += 1900;
$mon += 1;
$datestr1 = sprintf("%02d%02d%04d",$mday, $mon, $year);
$DataDir = "/cygdrive/c/ODIN/DIET/Data";
$OutDir = ""; # Specify path to your favorite directory
#$datestr1 = "04082008";
%FileMap = (
"NIFTY", $datestr1 . "_S&P CNX NiftyIndexChart.txt",
"NIFTY-I", "64637_2_". $datestr1 . "_NREAL.txt",
"NIFTY-II", "64637_2_". $datestr1 . "_NREAL.txt",
"MIDCAP50", $datestr1 . "_Nifty Midcap 50IndexChart.txt",
"JUNIOR", $datestr1 . "_CNX Nifty JuniorIndexChart.txt",
"BANK", $datestr1 . "_BANK NiftyIndexChart.txt",
"CNXIT", $datestr1 . "_CNX ITIndexChart.txt",
"LT-I", "64771_2_" . $datestr1 . "_NREAL.txt",
"RELCAPITAL-I", "64817_2_" . $datestr1 . "_NREAL.txt",
"SBIN-I", "64827_2_" . $datestr1 . "_NREAL.txt",
"SUZLON-I", "64841_2_" . $datestr1 . "_NREAL.txt",
"JPASSOC-I", "64759_2_" . $datestr1 . "_NREAL.txt",
"RELIANCE-I", "64818_2_" . $datestr1 . "_NREAL.txt"
);
foreach $i (keys %FileMap) {
print "$i $FileMap{$i}\n";
$status = open FIN,"<$DataDir/$FileMap{$i}" ;
print "status $status\n";
open FOUT,">$OutDir/$i.txt";
while (<FIN>) {
print FOUT "$i,$datestr1,$_";
}
close FIN;
}