sed to remove pattern ','

Giorgos Keramidas keramida at ceid.upatras.gr
Thu Apr 10 12:19:59 PDT 2003


On 2003-04-11 00:30, adrian kok <adriankok2000 at yahoo.com.hk> wrote:
> hi all
>
> I have problem to replace the pattern ',' to |
> can you give me hint?

Use double quotes.

> data:          'peter','30 Woodroad, CA','USA'
>                  'coral','110 Foreest','UK'
>
> to
>  'peter|30 Woodroad, CA|USA'
>  'coral|110 Foreest|UK'
>
> and I used the following but failed
>
> sed -e 's/\','/\|/g

Quoting is something that depends on the shell you're writing this for.
Since you didn't mention any shells here, I can't say if this is correct
or wrong and in what ways it could be wrong.  Try this in sh(1):

	sed -e "s/','/|/g" lala

- Giorgos



More information about the freebsd-questions mailing list