truncating leading zeros of a column in a file

Hi

I have a file in which I have 5 columns which are delimited by �|� as shown

ABC|12|YAK|METRIC|000000019.5

XYZ|10|ABX|META|000000002.5

Now my requirement is to take the last column trim the leading zero's for that column values and write back to the same file in the same order.

Any suggestions regarding the same?
is der any file utility do the same?

Thanks
Narendar

# awk  'BEGIN{FS=OFS="|"}{$NF=$NF+0}1' file
ABC|12|YAK|METRIC|19.5
XYZ|10|ABX|META|2.5

hi i am getting the following error when i used the awk command

awk 'BEGIN{FS=OFS="|"}{$NF=$NF+0} 1' $filename
Error:
awk: syntax error near line 1
awk: bailing out near line 1

if possible can you explain what is this awk command doing here?

Thanks
Narendar

change "1" to {print} .
read the man page for the definition of NF. I am bad at explaining, maybe someone is kind enough to help out.

Hi,
Try this code,its not tested though..

#!/bin/ksh
cat test19 | for i in file
do
cut -d"|" -f5 | tr -s "00" $i
done

change 1 to {print},its working perfectly fine.

yeah its printing the contents ..but i want to write it to same file....

Redirect this output to a file and then move that file to the old file.