Hoe to run multi file searches as a script or macro

2014-10-23 Thread mmb21003200
Hi,

I am not new to BBEdit but I have never done any scripting, and it seems 
that text factory will not do what I want so I am looking for pointers to 
scripts or whatever to do this:

1. Run multi finds using  a series of grep searches (not replaces). There 
might be up to 10 or more searches.
2. Put the output found (results) into one document so they are all 
together (prefixed by document path where they were found)

I know I can do this manually but I would really like it to be automated 
and guess it has to be applescript (or perl).

Many thanks.

---
Mark

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Hoe to run multi file searches as a script or macro

2014-10-23 Thread Charlie Garrison

Good morning,

On 23/10/14 at 12:25 PM -0700, mmb21003...@gmail.com wrote:

I am not new to BBEdit but I have never done any scripting, and 
it seems that text factory will not do what I want so I am 
looking for pointers to scripts or whatever to do this:


1. Run multi finds using  a series of grep searches (not 
replaces). There might be up to 10 or more searches.
2. Put the output found (results) into one document so they are 
all together (prefixed by document path where they were found)


I know I can do this manually but I would really like it to be 
automated and guess it has to be applescript (or perl).


You just described `grep` command line. You will probably need 
to read some docco:


From command line (Terminal):
  man grep

Or online:
  https://www.gnu.org/software/grep/manual/grep.html

Put all your search patterns in one file (eg. search-patterns.txt):
search.*1 pattern
pattern.*2
search.*10

Then run grep

  grep -R -f search patterns.txt path/to/files/ > found-results.txt
  bbedit found-results.txt

Or go straight to bbedit:

  grep -R -f search patterns.txt path/to/files/ | bbedit found-results.txt

If you want to avoid Terminal, then run the above in a BBEdit worksheet.

Note, grep has regular and 'extended' regex syntax, which is why 
I said you may need to read docco. It depends on how complex 
your search terms are.



Charlie

--
   Charlie Garrison  
   github.com/cngarrison   metacpan.org/author/CNG

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt

--
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email

"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Hoe to run multi file searches as a script or macro

2014-10-23 Thread Christopher Stone
On Oct 23, 2014, at 14:25, mmb21003...@gmail.com wrote:
> 1. Run multi finds using  a series of grep searches (not replaces). There 
> might be up to 10 or more searches.
> 2. Put the output found (results) into one document so they are all together 
> (prefixed by document path where they were found)
__

Hey Mark,

I believe you initially said you wanted to delete or move the matched files, so 
I'm going to start with that.

I have commented-out delete in the script below, so you can see how it works 
without sending anything to the trash.  Uncomment # delete foundFiles and 
remove foundFiles to send the found files to the trash.

I've employed the long form of command-line switches for clarity.

---
set targetFolder to quoted form of "/Users/chris/test_directory/folders_nested/"
set _patterns to quoted form of "
one.*four
three.*nine
ten.*twenty
"

set shCMD to "grep --extended-regexp --ignore-case --recursive" & " \"" & 
_patterns & "\" " & targetFolder & " \\
| sed -En '/:/{
s!:[^:]+$!!
p
}
' \\
| sort -u"

set foundFiles to do shell script shCMD

if foundFiles ≠ "" then
  
  set foundFiles to paragraphs of foundFiles
  repeat with i in foundFiles
set contents of i to alias POSIX file i
  end repeat
  
  tell application "Finder"
# delete foundFiles
  end tell
  
  foundFiles
  
end if
-

Move the found files instead of deleting them.

The destination folder must already exist, although it wouldn't be difficult to 
make one on-the-fly.

The Finder's move command has a replacing option that will replace any 
collisions.  I have NOT used that in the script.

---
set targetFolder to quoted form of "/Users/chris/test_directory/folders_nested/"
set destFolder to alias "Ryoko:Users:chris:Downloads:dest:"
set _patterns to quoted form of "
one.*four
three.*nine
ten.*twenty
"

set shCMD to "grep --extended-regexp --ignore-case --recursive" & " \"" & 
_patterns & "\" " & targetFolder & " \\
| sed -En '/:/{
s!:[^:]+$!!
p
}
' \\
| sort -u"

set foundFiles to do shell script shCMD

if foundFiles ≠ "" then
  
  set foundFiles to paragraphs of foundFiles
  repeat with i in foundFiles
set contents of i to alias POSIX file i
  end repeat
  
  tell application "Finder"
move foundFiles to destFolder
  end tell
  
end if
-

Now let's use `bbfind` instead of `grep` to send the file-path plus found text 
to a new document in BBEdit:

---
set targetFolder to quoted form of "/Users/chris/test_directory/folders_nested/"
set _patterns to "one.*four|three.*nine|ten.*twenty"
set shCMD to "PATH=/usr/local/bin:$PATH;
bbfind \"" & _patterns & "\" --grep " & targetFolder & " \\
| bbedit"
do shell script shCMD
---

Now let's rewrite that as a pure shell script.

It could be written as a one-liner, but I've broken it up to be easier to read 
(hopefully).

#! /usr/bin/env bash

grepPatterns="one.*four|three.*nine|ten.*twenty";

targetFolder="/Users/chris/test_directory/folders_nested/";

bbfind "$grepPatterns" --grep "$targetFolder" | bbedit

As you can see your task isn't overly difficult.

--
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
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Hoe to run multi file searches as a script or macro

2014-10-23 Thread Christopher Stone
On Oct 23, 2014, at 23:31, Christopher Stone  wrote:
> I believe you initially said you wanted to delete or move the matched files, 
> so I'm going to start with that.
__

Hey Mark,

I think I confused you with a guy on the TextWrangler list.  Sorry 'bout that.

I think I've provided a solution to the actual problem you posted, but do let 
me know if I've missed the boat.

--
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
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Hoe to run multi file searches as a script or macro

2014-10-24 Thread Dave
But Mac OS X no longer includes gnu grep, more's the pity. They replaced it 
with the BSD version. There are a number of differences, the most 
significant one being the lack of a -P option.

Apple's grep manpage is available online 
here: 
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/grep.1.html

On Thursday, October 23, 2014 5:46:57 PM UTC-4, Charlie Garrison wrote:
>
>
> Or online: 
>https://www.gnu.org/software/grep/manual/grep.html 
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Hoe to run multi file searches as a script or macro

2014-10-24 Thread mmb21003200
I can't get it working with the -f parameter, nothing is returned, but if I 
put regex inline then it is ok.

grep \@due  ~/Dropbox/Taskpaper/Main/*



I think it is probably better to go the applescript route. I am actually 
using BBEdit v11 on x.10 but had a similar problem on mavericks. The simple 
multi file find can probably be scripted to repeat itself, I had initially 
tried using process lines containing ... but this deletes all the non 
matching.


I do have some basic perl knowledge so may be able to do it using that 
instead, passing the files in as parameters, but they are in different 
nested folders.


BTW, how do I get commands to run in the Unix worksheet, cmd enter does not 
do anything ? (I need to RTFM).


Thanks again.


---

Mark




-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Hoe to run multi file searches as a script or macro

2014-10-24 Thread mmb21003200

>
>
>
> BTW, how do I get commands to run in the Unix worksheet, cmd enter does 
> not do anything ? (I need to RTFM).
>
>
>
*Ok so it is ctrl return, my mistake (old macs never used to use the ctrl 
key as a **modifier!)*


*Got the results using Perl but as it is rusty, I need to work on getting 
a direc**tory  list and then executing the script on each 
file, can't remember how to process more than one file at a time or use 
wildcards.*


*Thanks for the tips anyway!*
 
---
Mark

 

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Hoe to run multi file searches as a script or macro

2014-10-25 Thread Charlie Garrison
Good afternoon,

On 24/10/14 at 2:49 AM -0700, Dave  wrote:

>But Mac OS X no longer includes gnu grep, more's the pity. They replaced it 
>with the BSD version. There are a number of differences, the most 
>significant one being the lack of a -P option.

Is that something recent? I'm stuck at 10.7, and I get:

$ grep -V
grep (GNU grep) 2.5.1

[I can't use the new BBE either. :-(  I'm looking at some new hardware for that 
reason alone.]


Charlie

-- 
   Charlie Garrison  
   github.com/cngarrison   metacpan.org/author/CNG

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Hoe to run multi file searches as a script or macro

2014-10-25 Thread Charlie Garrison

Good afternoon,

On 24/10/14 at 1:29 PM -0700, mmb21003...@gmail.com wrote:

*Ok so it is ctrl return, my mistake (old macs never used to 
use the ctrl key as a **modifier!)*


I've never had to use CTRL, just press ENTER.

*Got the results using Perl but as it is rusty, I need to work 
on getting a direc**tory  list and then executing the script on 
each file, can't remember how to process more than one file at 
a time or use wildcards.*


Which results?

The OP said:

2. Put the output found (results) into one document so they are 
all together (prefixed by document path where they were found)


Tell us what you *really* want to achieve and I can probably 
suggest a better solution.


Based on the above requirement, my original suggestion using 
grep is still the best solution, short of re-inventing the wheel.



Charlie

--
   Charlie Garrison  
   github.com/cngarrison   metacpan.org/author/CNG

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt

--
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email

"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Hoe to run multi file searches as a script or macro

2014-10-25 Thread Charlie Garrison

Good afternoon,

On 24/10/14 at 4:37 AM -0700, mmb21003...@gmail.com wrote:

I can't get it working with the -f parameter, nothing is 
returned, but if I put regex inline then it is ok.


As Dave pointed out; that might be due to different version of 
grep; read the docco at the link he supplied (assuming you have 
current OS).



I think it is probably better to go the applescript route.


Not if you want the search to actually finish while you're still 
at work. Really, you could not have described grep any better; 
it's the tool you want; re-inventing a perfectly good tool makes 
no sense.



I am actually using BBEdit v11 on x.10 but had a similar problem on
mavericks. The simple multi file find can probably be scripted to
repeat itself, I had initially tried using process lines containing ...
but this deletes all the non matching.


Sure it can be scripted. But will take much longer to write that 
script, and will take **MUCH** longer to run that script. The 
time it takes you to read the grep docco will be less than the 
time it takes to re-invent grep.


I do have some basic perl knowledge so may be able to do it 
using that instead, passing the files in as parameters, but 
they are in different nested folders.


Yep, Perl is much better suited (close to its original design 
purpose), but it's still not needed. It's overkill for the 
described problem. Of course, the real problem may be different 
than the described problem, in which case my suggestions could 
be very wrong.


Combine grep with xargs, and I'd be *VERY* surprised if you need 
any scripting at all. Eg. the need to delete matched files 
(discussed earlier) would simply be:


grep -R -l "find this string" in/this/path/ | xargs rm

That command WILL delete all matched files (so be careful); 
should be interactive though, the following will force delete:


grep -R -l "find this string" in/this/path/ | xargs rm -f

BTW, how do I get commands to run in the Unix worksheet, cmd 
enter does not do anything ? (I need to RTFM).


Yep, RTFM, cmd-enter does not do anything. Just press enter.


Charlie

--
   Charlie Garrison  
   github.com/cngarrison   metacpan.org/author/CNG

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt

--
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email

"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Hoe to run multi file searches as a script or macro

2014-10-25 Thread Stan Ulrich
CAN WE PLEASE CORRECT THE "Hoe" to "How" for all of us INNOCENT BYSTANDERS??


On Oct 25, 2014, at 8:27 PM, Charlie Garrison wrote:

> Good afternoon,
> 
> On 24/10/14 at 2:49 AM -0700, Dave  wrote:
> 
>> But Mac OS X no longer includes gnu grep, more's the pity. They replaced it 
>> with the BSD version. There are a number of differences, the most 
>> significant one being the lack of a -P option.
> 
> Is that something recent? I'm stuck at 10.7, and I get:
> 
> $ grep -V
> grep (GNU grep) 2.5.1
> 
> [I can't use the new BBE either. :-(  I'm looking at some new hardware for 
> that reason alone.]
> 
> 
> Charlie
> 
> -- 
>   Charlie Garrison  
>   github.com/cngarrison   metacpan.org/author/CNG
> 
> O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
> http://www.ietf.org/rfc/rfc1855.txt
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a 
> feature request or would like to report a problem, please email
> "supp...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter: 
> 
> --- 
> 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 bbedit+unsubscr...@googlegroups.com.
> To post to this group, send email to bbedit@googlegroups.com.

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Hoe to run multi file searches as a script or macro

2014-10-25 Thread Charlie Garrison
Good afternoon,

On 25/10/14 at 8:51 PM -0600, Stan Ulrich  wrote:

>CAN WE PLEASE CORRECT THE "Hoe" to "How" for all of us INNOCENT BYSTANDERS??

Are you against gardening?

BTW, you didn't change it yourself.  ;-)

I'm leaving it as-is for sake of threading.

Charlie
-- 
   Charlie Garrison  
   github.com/cngarrison   metacpan.org/author/CNG

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Hoe to run multi file searches as a script or macro

2014-10-26 Thread Stan Ulrich
I love gardening friend. Didn't feel empowered to change it. 

Sent from iPhone Binky

> On Oct 25, 2014, at 9:14 PM, Charlie Garrison  wrote:
> 
> Good afternoon,
> 
>> On 25/10/14 at 8:51 PM -0600, Stan Ulrich  wrote:
>> 
>> CAN WE PLEASE CORRECT THE "Hoe" to "How" for all of us INNOCENT BYSTANDERS??
> 
> Are you against gardening?
> 
> BTW, you didn't change it yourself.  ;-)
> 
> I'm leaving it as-is for sake of threading.
> 
> Charlie
> -- 
>   Charlie Garrison  
>   github.com/cngarrison   metacpan.org/author/CNG
> 
> O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
> http://www.ietf.org/rfc/rfc1855.txt
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a 
> feature request or would like to report a problem, please email
> "supp...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter: 
> 
> --- 
> 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 bbedit+unsubscr...@googlegroups.com.
> To post to this group, send email to bbedit@googlegroups.com.

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Hoe to run multi file searches as a script or macro

2014-10-27 Thread Dave
I think they made that change in mountain lion, but it could have been lion.

When you get your new machine you might want to download the latest gnu grep. 
Drop me a line if you need help building it with PCRE support. 

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Hoe to run multi file searches as a script or macro

2014-10-27 Thread Dave
The -f option didn't change. I think it's a posix standard. The path to the 
pattern file has to immediately follow the -f, and the patterns have to be 
LF-delimited. I've used it in both BSD grep and gnu grep. 

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Hoe to run multi file searches as a script or macro

2014-10-27 Thread mmb21003200

Using grep works but only one search at a time because of my limited 
knowledge of regexp !

How do I do a regexp search with multiple finds but excluding certain 
patterns so for example in Perl I can do

print if (/^.*\@thisweek(?!.*\@done).*/);
print if (/^.*\@nextweek(?!.*\@done).*/); etc

Not great as would rather do it in one pattern, but it does return what I 
want.

So Ideally I want to find all lines with '@due' OR '@next-week' OR '@next 
month' but NOT @done

Cant understand why a multi file search using text factory  in BBE won't 
allow the results to go into a new window.

Thanks.
---
Mark

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Hoe to run multi file searches as a script or macro

2014-10-27 Thread Dave
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.

On Monday, October 27, 2014 4:53:57 AM UTC-4, mmb21...@gmail.com wrote:
>
>
> Using grep works but only one search at a time because of my limited 
> knowledge of regexp !
>
> How do I do a regexp search with multiple finds but excluding certain 
> patterns so for example in Perl I can do
>
> print if (/^.*\@thisweek(?!.*\@done).*/);
> print if (/^.*\@nextweek(?!.*\@done).*/); etc
>
> Not great as would rather do it in one pattern, but it does return what I 
> want.
>
> So Ideally I want to find all lines with '@due' OR '@next-week' OR '@next 
> month' but NOT @done
>
> Cant understand why a multi file search using text factory  in BBE won't 
> allow the results to go into a new window.
>
> Thanks.
> ---
> Mark
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Hoe to run multi file searches as a script or macro

2014-10-27 Thread Christopher Stone
On Oct 25, 2014, at 21:45, Charlie Garrison  wrote:
> 
>> BTW, how do I get commands to run in the Unix worksheet, cmd enter does not 
>> do anything ? (I need to RTFM).
> 
> Yep, RTFM, cmd-enter does not do anything. Just press enter.
__

This is a new convention in BBEdit 11.

'Cmd-Return' or 'Enter' used to be the default invocation hotkeys.

'New Line After Paragraph' has taken over Cmd-Return, and 'New Line Before 
Paragraph' has taken over Cmd-Shift-Return.

'Ctrl-Return' and 'Enter' are the NEW defaults.  The latter is a long reach on 
a full-size keyboard, so I prefer the former.

--
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
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Hoe to run multi file searches as a script or macro

2014-10-28 Thread Christopher Stone
On Oct 27, 2014, at 18:56, Dave  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
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Hoe to run multi file searches as a script or macro

2014-10-29 Thread mmb21003200
Chris,

The bbfind command was very useful and works well for me in a worksheet, many 
thanks.

Mark

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.