Date: Fri, 05 Sep 2008 20:38:16 +0300 From: Giorgos Keramidas <keramida@freebsd.org> To: "Mark B." <mkbucc@gmail.com> Cc: freebsd-questions@freebsd.org Subject: Re: How to delete non-ASCII chars in file Message-ID: <871vzyo5mf.fsf@kobe.laptop> In-Reply-To: <59f4cb420809050927w71fea733mcf7a2071c24cdc93@mail.gmail.com> (Mark B.'s message of "Fri, 5 Sep 2008 12:27:12 -0400") References: <59f4cb420809050714i16ebe30bmd9f325592f05516e@mail.gmail.com> <87vdxa4p2p.fsf@kobe.laptop> <59f4cb420809050927w71fea733mcf7a2071c24cdc93@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-= On Fri, 5 Sep 2008 12:27:12 -0400, "Mark B." <mkbucc@gmail.com> wrote: > On Fri, Sep 5, 2008 at 10:58 AM, Giorgos Keramidas > <keramida@ceid.upatras.gr> wrote: > >> $ echo '^Fhello^F' | sed -e 's/[^[:print:]]*//' | hd >> 00000000 68 65 6c 6c 6f 06 0a |hello..| >> 00000007 >> $ > > In case you are interested, I've patched the re_format man page with > this example. I had read it, and it says :print: is the "name of the > character class." I think the concrete example helps clarify things. Excellent, thank you! Using your text as a starting point, I've committed two examples to the manpage now: one for matching the characters of a class, and one for matching all the characters *not* in a class. %%% Index: re_format.7 =================================================================== --- re_format.7 (revision 182794) +++ re_format.7 (working copy) @@ -288,6 +288,14 @@ A locale may provide others. A character class may not be used as an endpoint of a range. .Pp +A bracketed expression like +.Ql [[:class:]] +can be used to match a single character that belongs to a character +class. +The reverse, matching any character that does not belong to a specific +class, the negation operator of bracket expressions may be used: +.Ql [^[:class:]] . +.Pp There are two special cases\(dd of bracket expressions: the bracket expressions .Ql [[:<:]] %%% Does this look ok? If not, we can commit a followup change and refine it in the next 2-3 days. Then I'll file an MFC request with our release engineering team, and merge it to stable branches too. > A follow question--is it possible to use that statement in a Makefile > (BSD)? A straight cut 'n paste didn't work, and I couldn't figure out > the escaping to make it work. It should be possible. Quoting may be a bit trickier in Makefiles, but can you show me the Makefile you tried? --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkjBbpEACgkQ1g+UGjGGA7amrACgrq57REp85vacZGXDOAP5czQk BP8An0riVDYhdu/uL7RBYItZh+Un3E5v =JuhF -----END PGP SIGNATURE----- --=-=-=--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?871vzyo5mf.fsf>