Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing decimal points 1

Status
Not open for further replies.

KenCunningham

Technical User
Mar 20, 2001
8,475
GB
Hi, to save me re-inventing the wheel, has anyone got a simple sed/awk routine or script to remove only decimal points from lines in a file, retaining those in names. For example, a line:

M. R. Russell 45.80

should become:

M. R. Russell 4580

Many thanks.
 
Hi,
the answer depends on what can be said about the structure of your input data;
e.g. if the decimal point to be removed always is in the same column, cut -c will do it.
hth
 
This sed removes the decimal point which is located between two numbers

sed -e 's/\([0-9]\)\.\([0-9]\)/\1\2/g' file

Jean Pierre.
 
Thanks/merci to both - Jean Pierre's was exactly what I was after.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top