I have a program that reads an input file and outputs the file, with
where I want each field to start from!
<PROG>
############################################################################
##########
open ORG,"<$ARGV[0]" or die "Cannot open $ARGV[0]",$!;
open NEW,">$ARGV[1]";
while($line=<ORG>){
chomp $line;
@fields = split ',',$line;
printf
ORG"%-9s%-15s%-40s%-15s\n",$fields[0],$fields[1],$fields[2],$fields[3];
}
close ORG;
close NEW;
exit;
[End of file]
############################################################################
###########
What I need help on please is 'How to specify at the COMMAND LINE
where I want each field to start from',
INSTEAD of specifying it from the in the programme!
At the moment I specify the positions in the programme by;
################################
printf
ORG"%-9s%-15s%-40s%-15s\n",$fields[0],$fields[1],$fields[2],$fields[3];
############################################################################
############
NOTE;
* The number of fields very all the time, as different input files
will have different amounts of fields.
* The start positions will always be different.
PS. Any help and advice would be very much appreciated.
Regards,
Govin.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]