Good morning everybody,
Beeing an absolute newbie in shell scripting I would like to look for some help here.
I would like to read an external text file and format the data and write it to an output file.
What I was trying to do was to display the result (this worked).
But now I would like to write this result to a external file.
I would appreciate that some of you guys could help me out with this.
Here is what I did.
#!/usr/bin/perl
$data_file="theoriginalfile";
open(DAT, $data_file) || die("Could not open file!");
@raw_data=<DAT>;
close(DAT);
## Start input to the output file
print "\$H:CREATE";
print "\n";
print "\$H:hardcodeevalue,hardcodeevalue,hardcodeevalue,hardcodeevalue";
print "\n";
foreach $lineintheoriginalfile (@raw_data)
{
chomp($lineintheoriginalfile );
($val1,$val2,$val3,$val4,$val5)=split(/\;/,$simline);
print "\$R:<PARENT>hardcodeevalue,${val1},,hardcodeevalue,,hardcodeevalue='':hardcodeevalue=${val2}:hardcodeevalue=${val3}:hardcodeevalue=${val4}:Profile=hardcodeevalue:A4KI=1:Model=hardcodeevalue:ADM=AA:Manufacturer=hardcodeevalue:OTA Key=1111 <CHILD>hardcodeevalue,${val5
},,L
OAD,,,";
print "\n";
}
print "\$F:";
#end input to the output file
print "\n";
the external file is similar to this
val1;val2;val3;val4;val5
val1;val2;val3;val4;val5
val1;val2;val3;val4;val5
I hope it's clear
Thank's a lot,