bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] How to unescape a string?


From: arnold
Subject: Re: [bug-gawk] How to unescape a string?
Date: Tue, 23 Oct 2018 23:42:24 -0600
User-agent: Heirloom mailx 12.4 7/29/08

David almost got it.  Here's the right way:

$ gawk 'BEGIN { a ="a\\\\b\\\""; print a; a = gensub(/\\(.)/, "\\1", "g", a);
> print a }'
a\\b\"
a\b"

HTH,

Arnold

david kerns <address@hidden> wrote:

> I was hoping this would, but it doesn't .. perhaps it will spur someone
> else :/
>
> awk 'BEGIN { a ="a\\\\b\\\""; print a; gensub(/\\(.)/, "\1", "g", a); print
> a }'
> a\\b\"
> a\\b\"
>
>
> On Tue, Oct 23, 2018 at 2:35 PM Peng Yu <address@hidden> wrote:
>
> > Hi,
> >
> > I have a string in which the double quote character is escaped as \"
> > (baskslash character and double quote character) and the backslash
> > character is escaped as \\ (double backslash). Does anybody know a
> > simple way to unescape such a string in awk? (The following is a
> > simple example of the input and the output.) Thanks.
> >
> > a\\b\" -> a\b"
> >
> > --
> > Regards,
> > Peng
> >
> >



reply via email to

[Prev in Thread] Current Thread [Next in Thread]