Code Comments
Programming Forum and web based access to our favorite programming groups.
Rookie Card wrote:
> Ed -
> awk '{ print substr($0,18,1) }' REC18.txt
> A
> B
> S
> A
>
> Then I try
> awk '{ print "A"==substr($0,18,1) }' REC18.txt
> 0
> 0
> 0
> 0
> This is with the example data: REC18.txt
> 20040911324834736A90028
> CLIENTID000VNI112B92658
> CLIENTID000VNI118S98271
> 20041112534129983A93065
> Thanks
> Gary / Rookie Card
>
Since neither oawk nor nawk would accept that last command, I assume
you're running gawk. Here's what happens when I use gawk version 3.0.4
on Solaris:
PS1> gawk '{ print substr($0,18,1) }' REC18.txt
A
B
S
A
PS1> gawk '{ print "A"==substr($0,18,1) }' REC18.txt
1
0
0
1
Regards,
Ed.
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.