Re: Find and Replace Feature

2015-03-12 Thread Christopher Stone
On Mar 02, 2015, at 21:32, Jared Roller  wrote:
> Yep, I think the most intuitive route for me would be for the replacement 
> patterns to work with the new Extract button in 'Find and Replace'.
__

Hey Jared,

I think your idea merits a feature request.  If you have not done so already 
please send one to Bare Bones Software .

And make your case.  Don't just write up the request - tell/show them WHY it 
would add value to BBEdit.

Keep in mind though that much is possible once you learn a bit about 
AppleScript and shell scripting.

---
#! /usr/bin/env bash

osascript -s o -e 'tell application "BBEdit" to return text of front text 
window' | tr '\r' '\n' \
| perl -wlne 'if ( m!(http://\S+).*(by Shane.+)!ims ) { print "$1\t$2" }';
---

This extracts the text from the front document and prints (to a window) a 
report of the items found by the perl regex using only the specific captures.

This particular code only operates on a per-line basis, but it is possible to 
match multiple line patterns.

When it comes to extracting text I generally prefer to use the Satimage.osax 
(AppleScript Extension), because it's easier to manage complex multiple line 
patterns.

A very simple example:

---
tell application "BBEdit"
  tell text of front text window to set _text to it
end tell
set foundText to find text "(?im)(^detect.+^detect[^\\r]+)" in _text using 
"\\1" with regexp, all occurrences and string result
tell application "BBEdit"
  make new document with properties {name:"Text Extraction - Unsaved", 
text:foundText}
end tell
---

Much of this can also be done with BBEdit's own AppleScript dictionary.

So what you want to do can be done NOW without a whole lot of learning on your 
part.

It's not as simple as pushing the {Extract} button, but it's pretty easy - 
especially if you keep a boilerplate script handy.

--
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: Find and Replace Feature

2015-03-03 Thread Jared Roller
Yep, I think the most intuitive route for me would be for the replacement 
patterns to work with the new Extract button in 'Find and Replace'. Because 
if I wanted to take multiple snapshots of different data within a larger 
data set, I could now handle the task quickly and non-destructively. But 
you're correct in that I can handle that by editing my original file first 
and then copying that work to a new file for further editing. It's just... 
there's... thisnew button and I want to push it more!!! :P

-- 
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: Find and Replace Feature

2015-03-02 Thread Maarten Sneep

> On 28 Feb 2015, at 18:58, Jared Roller  wrote:
> 
> Thanks Maarten. I can't be 100% sure, but I think this feature lacks any 
> 'replace' option, or the ability to snag the \1, \2,\3 subpatterns. But maybe 
> extraction would be nice to add to 'process' instead of find and replace. 
> That would seem to make more sense.

Process lines containing can send the matching lines to a new document. You can 
use grep for the pattern, but indeed not copy specific subpatterns. I was 
mistaken, the ‘Process duplicate lines’ does accept subpatterns. Time for a 
feature request, I think. 

> My thoughts are you couldn't pull this off without using some kind of 
> extraction. Basically, the extraction feature shows some opportunity with 
> grep to map sections of data, format and copy the result to a new file. :) 

You can of course use a two-stage process: Modify first to get related 
information on a single line, then copy to a new file, and finally remove what 
is not needed.

OK, that can be improved.

Maarten

-- 
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: Find and Replace Feature

2015-03-02 Thread Jared Roller

Sure. :D
Say you own an apple shop, but your report only spits info in rows of 3.

Minecraft Apples
Red AppleShort description of apple with standards and 
stuff
2.23 1.80 .70 (tiered loyalty pricing) 123556 (item number)

Pretend you have 20,000 rows of this stuff. So, you want this unstructured 
stuff to be in a structured format superquick.

1)  Go to the find window click 'grep'
([ A-Za-z0-9]{25})\s*\n([ 
A-Za-z]{25})\s*([A-Za-z]*)$\n([0-9]?[0-9]?.[0-9][0-9])\s([0-9]?[0-9]?.[0-9][0-9])\s([0-9]?[0-9]?.[0-9][0-9])\s*([0-9]*)

I have found that BBEdit will grep multiple lines of data like this. (wrote 
this just as an example, so might be some errors)
The important thing is subpatterns (in parenthesis)
Well, if I could just tick the 'Extract Grep' boolean at this point and 
enter something like this in the Replace field, 

Apple Categories, Apple Type, Apple Description, Item Number, Price1, 
Price2, Price3
\1, \2, \3, \7, \4, \5, \6

Press extract and the new file has all of this sorted. 

The example could probably be simplified, but that's just one way I'd find 
something like it very useful. 





On Friday, February 27, 2015 at 6:47:08 PM UTC-6, Oliver Taylor wrote:
>
> > On 27 Feb 2015, at 12:27 PM, Jared Roller  > wrote: 
> > 
> > For me, the ability to 'extract with new formatting and subpattern 
> replacement' would save several steps with unstructured data. 
>
> Can you give a specific example?

-- 
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: Find and Replace Feature

2015-03-02 Thread Jared Roller
Thanks Maarten. I can't be 100% sure, but I think this feature lacks any 
'replace' option, or the ability to snag the \1, \2,\3 subpatterns. But 
maybe extraction would be nice to add to 'process' instead of find and 
replace. That would seem to make more sense.
My thoughts are you couldn't pull this off without using some kind of 
extraction. Basically, the extraction feature shows some opportunity with 
grep to map sections of data, format and copy the result to a new file. :) 
 

> Does “Process lines containing” in the “Text” menu do what you want? 
>
> Maarten

-- 
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: Find and Replace Feature

2015-02-28 Thread Maarten Sneep

> On 27 Feb 2015, at 21:27, Jared Roller  wrote:
> 
> I have been using this fantastic app for wrangling some unstructured text. 
> Just glancing through the board, it appears I'm not alone.
> I've been using BBEdit with grep to tackle most solutions, with an aversion 
> to learning awk while there was real work on my plate. 
> But what would make munging unstructured data easier?
> 
> For me, the ability to 'extract with new formatting and subpattern 
> replacement' would save several steps with unstructured data. 
> I'm not sure how that would look, but it would be quite handy to format and 
> extract anything I want (based on the subpattern placement) 
> to a new file. 

Does “Process lines containing” in the “Text” menu do what you want?

Maarten

-- 
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: Find and Replace Feature

2015-02-27 Thread Oliver Taylor
> On 27 Feb 2015, at 12:27 PM, Jared Roller  wrote:
> 
> For me, the ability to 'extract with new formatting and subpattern 
> replacement' would save several steps with unstructured data. 

Can you give a specific example?

-- 
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.


Find and Replace Feature

2015-02-27 Thread Jared Roller
I have been using this fantastic app for wrangling some unstructured text. 
Just glancing through the board, it appears I'm not alone.
I've been using BBEdit with grep to tackle most solutions, with an aversion 
to learning awk while there was real work on my plate. 
But what would make munging unstructured data easier?

For me, the ability to 'extract with new formatting and subpattern 
replacement' would save several steps with unstructured data. 
I'm not sure how that would look, but it would be quite handy to format and 
extract anything I want (based on the subpattern placement) 
to a new file. 

I'm relatively new to programming, so didn't want to submit a feature 
request quite yet. And maybe something like this could be tackled
with a plugin? 

Stuff like that.. Glad I found the forum, and thanks for reading.

-- 
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: Find and Replace feature missing in new version

2009-04-27 Thread Rich Siegel

On 4/27/09 at 1:43 PM, ninjar...@gmail.com (ninjaroll) wrote:

>in the dialog box that pops up, was able to press a button with this
>symbol "§", and whatever text was highlighted in the main window was
>then applied to the "Find and Replace".

"Use Selection for Find" and "Use Selection for Replace" work 
when the Find (or Multi-File Search) window is in front, and 
serve the same function.

Enjoy,

R.
-- 
Rich Siegel Bare Bones Software, Inc.
  

Someday I'll look back on all this and laugh... until they 
sedate me.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "BBEdit Talk" group.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a specific feature request or would like to report a suspected (or 
confirmed) problem with the software, please email to "supp...@barebones.com" 
rather than posting to the group.
-~--~~~~--~~--~--~---



Find and Replace feature missing in new version

2009-04-27 Thread ninjaroll

Hello,
I just upgraded from 8.7.2 to the latest version of BBEdit.  I just
noticed that there is a feature that was taken out that I found highly
useful in the Find Replace dialog box.

In the older version, I was able to select text in the main window,
select "Find Replace" from the dropdown menu, and in the dialog box
that pops up, was able to press a button with this symbol "§", and
whatever text was highlighted in the main window was then applied to
the "Find and Replace".

What happened to this?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "BBEdit Talk" group.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a specific feature request or would like to report a suspected (or 
confirmed) problem with the software, please email to "supp...@barebones.com" 
rather than posting to the group.
-~--~~~~--~~--~--~---