bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

print keep original format


From: lina
Subject: print keep original format
Date: Wed, 25 May 2011 22:37:33 +0800

Hi,

if I wanna change $4 to B and print the line out

497  FE  HEM A  43     -12.543  18.254  -4.989  1.00  0.00


for a short awk script, such as


awk '{
        if($2 == 497)
        {
                $5="B"
                print $0
        }
}' $1

but the output the space between them has gone. jt turned out loss the format.
497 FE HEM B 43 -12.543 18.254 -4.989 1.00 0.00

497  FE  HEM A  43     -12.543  18.254  -4.989  1.00  0.00

can anyone give me some suggestion? Is it necessary to use printf in this issue

Thanks,
-- 
Best Regards,

lina



reply via email to

[Prev in Thread] Current Thread [Next in Thread]