From owner-freebsd-questions@FreeBSD.ORG Fri Sep 5 17:39:00 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF484106564A for ; Fri, 5 Sep 2008 17:39:00 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id 451F68FC1B for ; Fri, 5 Sep 2008 17:38:59 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from kobe.laptop (ppp238-137.adsl.forthnet.gr [77.49.17.137]) (authenticated bits=128) by igloo.linux.gr (8.14.3/8.14.3/Debian-5) with ESMTP id m85Hcdtn027528 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 5 Sep 2008 20:38:45 +0300 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.3/8.14.3) with ESMTP id m85HcW7U002451; Fri, 5 Sep 2008 20:38:32 +0300 (EEST) (envelope-from keramida@freebsd.org) Received: (from keramida@localhost) by kobe.laptop (8.14.3/8.14.3/Submit) id m85HcPIW002450; Fri, 5 Sep 2008 20:38:25 +0300 (EEST) (envelope-from keramida@freebsd.org) From: Giorgos Keramidas To: "Mark B." References: <59f4cb420809050714i16ebe30bmd9f325592f05516e@mail.gmail.com> <87vdxa4p2p.fsf@kobe.laptop> <59f4cb420809050927w71fea733mcf7a2071c24cdc93@mail.gmail.com> Date: Fri, 05 Sep 2008 20:38:16 +0300 In-Reply-To: <59f4cb420809050927w71fea733mcf7a2071c24cdc93@mail.gmail.com> (Mark B.'s message of "Fri, 5 Sep 2008 12:27:12 -0400") Message-ID: <871vzyo5mf.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-MailScanner-ID: m85Hcdtn027528 X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-4.284, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.12, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@freebsd.org X-Spam-Status: No Cc: freebsd-questions@freebsd.org Subject: Re: How to delete non-ASCII chars in file X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Sep 2008 17:39:00 -0000 --=-=-= On Fri, 5 Sep 2008 12:27:12 -0400, "Mark B." wrote: > On Fri, Sep 5, 2008 at 10:58 AM, Giorgos Keramidas > 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----- --=-=-=--