Re: find with pipe to grep
From: Marek Stepanek (mstep_at_t-online.de)
Date: 07/25/05
- Next message: Matteo Corti: "Re: find with pipe to grep"
- Previous message: oraustin_at_hotmail.com: "Re: sed search and replace"
- In reply to: Matteo Corti: "Re: find with pipe to grep"
- Next in thread: Matteo Corti: "Re: find with pipe to grep"
- Reply: Matteo Corti: "Re: find with pipe to grep"
- Reply: Bill Marcum: "Re: find with pipe to grep"
- Reply: Chris F.A. Johnson: "Re: find with pipe to grep"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 25 Jul 2005 13:31:33 +0200
On 25.07.2005 13:01, in article
slrnde9hk2.n5i.matteo.corti@casa.dyndns.info, "Matteo Corti"
<matteo.corti@gmail.com> wrote:
>
> Mmmm it seems that you need a more regular expression. Try with
>
> find -regex '.*\.html?$'
>
> This means: everything (.) repeated zero or more times (*) followed by a dot
> (escaped since in regex syntax the dot means everything) followed by htm and
> an optional l. The $ at the end means end of line.
>
>
> This is most probably due to the fact that you have spaces in your file
> names. grep is not able to understand them if they are not escaped.
>
> I don't know if this is the best option but you can put quotes around the
> file names like that
>
> find -regex '.*\.html?$' -printf '"%p"\n'
>
> If you pass these results to grep it will interpret them considering the
> space.
>
> Cheers,
>
> Matteo
thank you Matteo,
great lesson :-) I know quite well my regex working with BBEdit on
Macintosh. But there is still a little problem :
[markslap:~/Documents/latex] mareklap% find -regex '.*\.html?' -printf
'"%p"' | xargs grep -l "tabular"
gives (Line break from my email client)
find: illegal option -- r
find: illegal option -- e
find: illegal option -- g
find: illegal option -- e
find: -printf: unknown expression primary
I tried with:
find -E -regex '.*\.html?' -printf '"%p"\n' | xargs grep -l "tabular"
but I am not understanding the man page :
-E Interpret regular expressions followed by -regex and -iregex
options as extended (modern) regular expressions rather than
basic regular expressions (BRE's). The re_format(7) manual
page fully describes both formats.
I also tried with :
% find -name -regex '.*\.html?' -printf '"%p"' | xargs grep -l "tabular"
% find -regex -name '.*\.html?' -printf '"%p"' | xargs grep -l "tabular"
thank you again
marek
-- ______________________________________________________________________ ___PODIUM_INTERNATIONAL_//_the_embassy_for_talented_young_musicians___ ______ Marek_Stepanek mstep_[at]_PodiumInternational_[dot]_org ______ _________________ http://www.PodiumInternational.org _________________ ______________________________________________________________________
- Next message: Matteo Corti: "Re: find with pipe to grep"
- Previous message: oraustin_at_hotmail.com: "Re: sed search and replace"
- In reply to: Matteo Corti: "Re: find with pipe to grep"
- Next in thread: Matteo Corti: "Re: find with pipe to grep"
- Reply: Matteo Corti: "Re: find with pipe to grep"
- Reply: Bill Marcum: "Re: find with pipe to grep"
- Reply: Chris F.A. Johnson: "Re: find with pipe to grep"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]