[Top][All Lists]

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

Re: say if grep can find non-ascii

From: Aharon Robbins
Subject: Re: say if grep can find non-ascii
Date: Tue, 07 Mar 2006 08:42:41 +0200

You should take jidanni with a large salt shaker handy. He expects all
GNU documentation to serve as cookbooks for any and every problem
he might like to solve, and is therefore upset when whatever problem
he's trying to solve at the moment isn't immediately there in whatever
documentation (man page, info file) he's looking at.

I've learned this the hard way with gawk.

Your answer as to what the grep man page can and should do is 100%
on target.


> Date: Mon, 06 Mar 2006 23:59:45 +0000
> From: Julian Foad <address@hidden>
> Subject: Re: say if grep can find non-ascii
> To: address@hidden
> Cc: address@hidden, Dan Jacobson <address@hidden>
> Dan Jacobson wrote:
> > The grep manual page should say how to do
> > $ perl -nwe 'print if /[^[:ascii:]]/'
> > but with grep. Or say if there's no way.
> I don't think the Grep manual should say explicitly how to do that particular 
> thing.  The Grep manual should (and does) describe exactly what Grep can do 
> and 
> how to make it do what it can do, and it may give some examples.  Is there 
> any 
> particular reason you feel it should describe how to do the equivalent of 
> your 
> particular Perl command?
> As far as I can tell, you want to find each line that contains a non-ASCII 
> character, except that I'm not sure what the definition of "ASCII" is in this 
> case, nor how the behaviour of this Perl command is affected by locale.
> I assume you've seen in Grep's manual (and I'll assume you're using Grep 
> v2.5.1) that it supports a set of character classes such as "[:alnum:]" but 
> not 
> "[:ascii:]".
> Does the following command do what you want?
>    grep '[ -~]'
> - Julian

reply via email to

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