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

Replace quotes with commas 1

Status
Not open for further replies.

kostyshock

Technical User
Sep 12, 2008
2
US
I'm having a problem with a text file that everything is enclosed by quotes and I would like to replace it with commas. Example:

R314236.2.2"FENCE"0"F;C""2""1"""""""""""""""""0"YARD"0"

I've already inserted titles

Now I need to change all the quotes to commas.

I'm new to unix so I tried this and it seems it didn't work:
sed '1,$s/\'"'/,/g' /MULT_IMSEGSNEW1.txt > MULT_IMSEGSNEW2.txt

could you please help me what I should put after sed?

Thanks

 
Hi

[ol]
[li]There is no need for special treatment for the inclusion of quote ( " ) character.
Code:
sed '1,$s/"/,/g' /MULT_IMSEGSNEW1.txt > MULT_IMSEGSNEW2.txt
[/li]
[li]There is no need for address.
Code:
sed 's/"/,/g' /MULT_IMSEGSNEW1.txt > MULT_IMSEGSNEW2.txt
[/li]
[li]The [tt]y///[/tt] command would be enough.
Code:
sed 'y/"/,/' /MULT_IMSEGSNEW1.txt > MULT_IMSEGSNEW2.txt
[/li]
[li][tt]tr[/tt] is better when comes about translation.
Code:
tr '"' ',' < /MULT_IMSEGSNEW1.txt > MULT_IMSEGSNEW2.txt
[/li]
[/ol]


Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top