Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Glob and grep



Nick Cross <zsh@xxxxxxxxx> wrote in news:15c62c86-5b55-e248-725f-
4ecbfe73822d@xxxxxxxxx:

> 
> Hi,
> 
> While I've been able to find varying amounts of information on the net 
I 
> haven't found quite enough to get the following working.
> 
> I would like to condense the following into a single grep / glob 
> expression where I search recursively through a directory tree, 
ignoring 
> any sub-trees starting with 'test' or 'target'.
> 
> grep <pattern> **/*.groovy  | egrep -v "(/test/|/target/)"

# zargs cope with large hierarchy

autoload zargs
zargs **/*.(js|php|css|inc)~(|libs|test|temp|node*|dump)/*~*/junk/* --
grep -i 2>/dev/null searchstr 

# alias which I tab expand then adjust as required
alias zg='zargs **/*.(php|inc|js)~(libs|test|temp|wiki|dompdf)/* -- grep
-i ' 





-- 
zzapper
https://twitter.com/dailyzshtip



Messages sorted by: Reverse Date, Date, Thread, Author