how to find spaces with a regex?

Jeff Largent jlargent at imagelinks.com
Mon Feb 23 13:15:42 UTC 2004


Actually \s in perl is any white space: tab, carriage return, formfeed, newline,
or space.

perl -nle 'print if /\ {2,3}/' filename



Vincent wrote:
> On Fri, 20 Feb 2004 18:25:58 -0800
> "Bevan C. Bennett" <bevan at fulcrummicro.com> wrote:
> 
> 
>>I don't think grep actually uses \s to mean a space... at least 'man 
>>grep' doesn't appear to mention it... although many other regexps do.
>>
> 
> 
> I think you may be right, perl certainly uses it and there is a grep -P option for perl regex though.

-- 
Jeff Largent                   ImageLinks, Inc.





More information about the fedora-list mailing list