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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

text qualifier in awk??

Status
Not open for further replies.

pavNell

Technical User
Sep 27, 2002
178
US
I have a comma delimited text file. The text for each field is enclosed in "". However, one of the fields contains a comma (to separate persons last name from first name). I'd like to replace the comma field separators to a colon, but leave the comma intact in the "persons name" field. Is this possible in [gn]awk? I've provided an example record...

"Smith, Joe","Development","555-1212","123 Main St"

Thanks.
 
Use sed to look for and replace all ","
sed 's/\&quot;,\&quot;/\&quot;:\&quot;/g' < infile > outfile


HTH
Dickie Bird (:)-)))
 
You're welcome !
sed 's/&quot;,&quot;/&quot;:&quot;/g' infile > outfile would have done - I often escape( using \) things I don't actually need to !
Cheers


Dickie Bird (:)-)))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top