well this code works, but the output is taking the current value and putting it in the front of the output, dont know whats going on.
, "76749" 7 13:40:00 2003","1.50","75","1103","78417"
, "78417" 7 13:41:00 2003","1.65","88","1099","79364"
"78417", should be at the end of the line not at the beginning. I am confused why this is happening.
so should look like,
"Feb 7 13:41:00 2003","1.65","88",'1099","79364","78417"
$data_file = "/root/bin/load.data2";
open(FILE,"<$data_file"
or die "Cant open $data_file2:$!\n";
@log = <FILE>;
$last_element='"0"';
foreach(@log){
chomp;
my@list = split',';
print"$_, $last_element\n";
$last_element = $list[$#list];
}
close (FILE);
, "76749" 7 13:40:00 2003","1.50","75","1103","78417"
, "78417" 7 13:41:00 2003","1.65","88","1099","79364"
"78417", should be at the end of the line not at the beginning. I am confused why this is happening.
so should look like,
"Feb 7 13:41:00 2003","1.65","88",'1099","79364","78417"
$data_file = "/root/bin/load.data2";
open(FILE,"<$data_file"
@log = <FILE>;
$last_element='"0"';
foreach(@log){
chomp;
my@list = split',';
print"$_, $last_element\n";
$last_element = $list[$#list];
}
close (FILE);