Hi ....
Iam having the file ....in which 3rd column is numerical having 8 decimal part... i want that to cut to 2 decimal part ...
Source File :
E100|0|19940.10104030|0|1ABC
E103|1|19942.10195849|3|0ABC
E100|0|19943.10284858|0|1ABC
I want to be ......
Reulst:
E100|0|19940.10|0|1ABC
E103|1|19942.10|3|0ABC
E100|0|19943.10|0|1ABC
Please help me .......
awk 'BEGIN{OFS=FS="|"}
{
$3=sprintf("%.2f",$3)
}1' file
Thanks yaar . Hi it is working fine.
if iam having 5th 9th column's also having the decimal numbers like earlier the same code can use ???
below is corr
awk 'BEGIN{OFS=FS="|"}
{
$3=sprintf("%.2f",$3) $5=sprintf("%.2f",$5) $9=sprintf("%.2f",$9)
}1' file.txt
put them on separate lines!
Iam confused ....
can you give me exact code please ...........