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!

Format changing in CSV File

Status
Not open for further replies.

ianicr

IS-IT--Management
Nov 4, 2003
230
GB
I have a CSV file with the following in:

Mr,John,Smith,0121-1234567
Mr,Gryff,Rhys-Jones,0121-2345678

Is there a way to remove the hyphen from the last field but not the surname field? I've tried a tr -d "-" on the file but this removes all the hyphens. Any ideas?
Thanks
 
nawk -f ian.awk ian.txt

#-------------- ian.awk
BEGIN {
FS=OFS=","
}

{
gsub("-", "", $NF);
print
}


vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top