On Oct 27, 2014, at 18:56, Dave <[email protected]> wrote:
> grep -RP "@(due|next(-week| month)).+(?!@done)" path > search_results.txt
> Should find all of them, but only if you have gnu grep with PCRE support.

______________________________________________________________________

Has PCRE in (gnu) grep gone live?  It was experimental.  Wunderbar!  This seems 
to be true in v2.2.

Even so - the OP need not install it to use PCRE.  The `bbfind` cli-tool that 
comes with BBEdit should work and should be more tolerant of different 
file-encodings.

#! /usr/bin/env bash
srcDir=~/'test_directory/folders_nested_one/';
destDir=~/'Desktop/Nuts in Training!/';
mkdir -pv "$destDir";
bbfind -gS '@(thisweek|nextweek)(?>(?!@done).)*$' "$srcDir" | sed -E 's/:.+$//' 
| sort --unique | xargs -J % cp -v % "$destDir"

The output directory is created if not extant.

I've used `cp` in this one to be non-destructive, but that's easy to change to 
`mv` or `rm`.

I've also set `cp` to verbose output, so I know exactly what was done.

--
Best Regards,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].

Reply via email to