AWK Question

Frank G. Fiamingo frank at hpuxa.ircc.ohio-state.edu
Thu Oct 5 07:06:46 AEST 1989


My problem is that I want to check a particular character
position in a record to see whether or not it is a blank.
If so, I want to change it to a zero.  I thought I could
do this with an awk script similar to the one below, but have
had no success.

BEGIN {FS=""}
{split($0,array);
if (array[28] == " ") {array[28] = 0};
for(i in array) print array[$1]}

However, it appears that split is only recognizing 2 fields
in the record, rather than the 35 characters that it contains.
Can anyone tell me where I've gone wrong, or a better way
to do this?

	Thanks,
	Frank



More information about the Comp.unix.questions mailing list