help-gawk
[Top][All Lists]
Advanced

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

Re: How to represent NBSP in gawk regex?


From: Wolfgang Laun
Subject: Re: How to represent NBSP in gawk regex?
Date: Mon, 21 Feb 2022 09:04:12 +0100

You can use a literal U+00A0; at least on my Ubuntu system it works just
fine:

$ gawk 'BEGIN { print "A   Z"}' | od -tx1    # three nbsp
0000000 41 c2 a0 c2 a0 c2 a0 5a 0a

I copy-pasted the nbsp from the HTML page provided by the OP.

-W

On Mon, 21 Feb 2022 at 04:43, david kerns <david.t.kerns@gmail.com> wrote:

> from the gawk user manual, my interpretation is that gawk only accepts
> UTF-8 encodings...
> from https://www.compart.com/en/unicode/U+00A0 the UTF-8 encoding of NBSP
> is: 0xC2 0xA0
>
> This seems to work for me:
>
> gawk 'BEGIN { nbsp = "\xc2\xa0"; print "A" nbsp "Z"}'
>
> (once you have the NBSP unicode in a var, you can substitute at will)
>
>
>
> On Sun, Feb 20, 2022 at 7:11 PM Peng Yu <pengyu.ut@gmail.com> wrote:
>
> > Hi,
> >
> > I want to substitute an NBSP character in gawk. I am not sure how to
> > enter such a Unicode character. Could anybody show me how to do it?
> > Thanks.
> >
> > https://www.compart.com/en/unicode/U+00A0
> >
> > --
> > Regards,
> > Peng
> >
> >
>


-- 
Wolfgang Laun


reply via email to

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