For Programmers: Free Programming Magazines  


Home > Archive > AWK > January 2005 > Re: Fixed length records containing 2 different records types with









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Fixed length records containing 2 different records types with
Ed Morton

2005-01-06, 3:57 pm



Rookie Card wrote:
> William - Thank you for replying
> I tried
> awk '"A"==substr($0,18,1)' REC18.txt >RECA.txt
> Output was Null
>
> Then I tried:
> awk '{ print "A"==substr($0,18,1) }' REC18.txt >RECA.txt
> Output was this:
> 0
> 0
> 0
> 0
> I get a 0 in the output file for every record in the input file.


The above are both telling you that none of the records in your input
file have an A in the 18th column. Do this:

awk '{ print substr($0,18,1) }' REC18.txt

to see what's really in the 18th column.

Ed.

> Strange.
> Getting close, I just can't see what I'm doing wrong.
> Gary / Rookie Card
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com