Stuart Clark wrote:
>
> Hi
Hello,
> How do I make the number between the "a" and the "z" take up 10
> positions within the line by adding zero's in front.
> The numbers between the "a" and "z" are not always the same length but
> they always start at the 24th position in the line.
>
> # start of file test
> 30000034364717283459322a15.32zM 042001H
> 30000045434551648534245a243.56zM 040532H
> 30000053232540927543293a2.45zM 040332H
> # end of file test
>
> open (IN,"test") || die "Could not open the test file\n";
> open (OUT,">result") || die "Error could not create the output
> file\n";
>
> while (<IN>) {
> s/a.*?z/WHAT GOES HERE?/;
s/a([\d.]+)z/sprintf"%011.2f",$1/e;
> print OUT $_;
> }
>
> close(IN) || die "Error cannot close test file\n";
> close(OUT) || die "Error cannot close output file\n";
>
> # output file must look like this
> 3000003436471728345932200000015.32M 042001H
> 3000004543455164853424500000243.56M 040532H
> 3000005323254092754329300000002.45M 040332H
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]