Re: Insert caret just before specified character
| Newsgroups | gmane.editors.sed.user |
|---|---|
| Organization | SYMC |
| Message-ID | <20150501125150.272c65d3@symmactoolkit-c02n3u69g3qj.symc.symantec.com> |
AG [U [Fri, 1 May 2015 12:46:39 -0700]:
> PLLC[U [Fri, 1 May 2015 12:38:42 -0700]:
>
> > How do I add caret '^' before each comma ',' in text string? Trying
> > this:
> >
> > echo {"errors":{"subject_id":["mandatory","Contact not exist."]}} |
> > sed.exe -e "s/,/^,/g"
> [...]
>
> Try enclosing the entire string in double-quotes or single-quotes,
> something like echo "("errors":...}}" | sed ...
>
> -Amarendra
[...]
Actually, not needed. Your first form works as-is on my W2K8 server
with GNU sed version 4.2.1.
-Amarendra