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!

Remove excess spaces from file 1

Status
Not open for further replies.

ianicr

IS-IT--Management
Nov 4, 2003
230
GB
Hi. I've got a file with UK postcode sectors in it eg.

AL 1 1
B 1 3
CH12 4
DE 3 5
and I need to remove all the spaces in the file before the last one to make the file:

AL1 1
B1 3
CH12 4
DE3 5

Does anyone know an easy way to do this?

Thanks
 
The following awk script is one way.

{
a=""
for (j=1;j<NF;j++) a=a $j
print a,$NF
}

CaKiwi
 
If I could give you more stars I would!!! thanks a lot!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top