Re: Help with a grep question

2018-02-04 Thread Christopher Stone
On 01/26/2018, at 20:56, Doug Lerner > 
wrote:
> What I would like to do is find everything between the ID_User_ and *-find 
> (e.g. .5a82483a in this example) and be left with a file where each line 
> contains just that userId. After that I can sort it, remove duplicates, etc.
> 
> Is there a sequence of things I can do, using grep search patterns, and so 
> on, to create a file from this file containing just the userIds?


Hey Doug,

This is the sort of job Perl is very good at.


#!/usr/bin/env perl -sw
use v5.010;
use open qw(:std :utf8);
use utf8;
# 
# Auth: Christopher Stone
# dCre: 2018/02/04 22:00
# dMod: 2018/02/04 22:16 
# Task: Find a regular expression per line, sort, and remove duplicates.
# Tags: @Shell, @Script, @Find, @Regular, @Expression, @Per, @Line, @Sort, 
@Remove, @Duplicates
# 

my (@Array, @Unique, %Hash, $Key);

while (<>) {
if ( /ID_User=(.*?)-find/ ) {
$Hash{$1} = 1;
}
}

foreach $Key (sort keys %Hash) {
say $Key;
}


The script processes a 100,000 line file in about a second on my old 2010 
MacBook Pro.


Now just for fun let's try that with a 1-line Bash script.


#!/usr/bin/env bash
LC_ALL='C'

sed -En '/ID_User=.*-find/{ s!ID_User=(.*)-find!\1!;p; }' | sort -u


Run either one of these as a BBEdit text-filter 
.

If you want to keep the original data file then run on a copy.

--
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.
Visit this group at https://groups.google.com/group/bbedit.


Re: Reload from Disk

2018-02-04 Thread Christopher Stone
Hey David,

You could give ‘Reload from Disk’ a keyboard shortcut in BBEdit's ‘Menus & 
Shortcuts’ prefs if manual activation would work for you.

As Rich mentioned – reloading isn't scriptable – but if you really need it to 
be then either Keyboard Maestro  or 
FastScripts  and UI-Scripting would 
probably be the way to go.

(BBEdit doesn't like doing UI-Scripting from its own script menu.)

Here's how to do it with AppleScript and UI-Scripting:


# Auth: Christopher Stone
# dCre: 2018/02/04 21:00
# dMod: 2018/02/04 21:10
# Appl: BBEdit, System Events
# Task: Activate ‘Reload from Disk’ menu item.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @System_Events, @Activate, 
@Reload_from_Disk, @Menu, @Item


tell application "System Events"
tell application process "BBEdit"
tell menu bar 1
tell menu bar item "File"
tell menu 1
tell menu item "Reload from Disk"
if enabled then
perform action "AXPress"
end if
end tell
end tell
end tell
end tell
end tell
end tell



Rich also mentioned that BBEdit is very good about reloading files when the 
disk content changes.

But ‘Automatically refresh documents as they change on disk’ must be turned 
[ON] in the ‘Application’ preference panel.

I have seen rare occasions when this didn't work properly with certain 
documents, although NOT so far with BBEdit 12.

--
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.
Visit this group at https://groups.google.com/group/bbedit.


Re: Search, start at top and other things

2018-02-04 Thread Christopher Stone
On 01/21/2018, at 09:56, John Muccigrosso > wrote:
> I can't seem to directly: 

> set PREV_SEARCH_STRING to search string of PREV_SEARCH_STRING


Hey John,

Under some circumstances you have to expand the property before you can get to 
the sub-properties:

tell application "BBEdit"
set PREV_SEARCH_STRING to search string of (get current search strings)
end tell

--
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.
Visit this group at https://groups.google.com/group/bbedit.


Re: Duplicate quotation marks

2018-02-04 Thread bruce linde
yes… it’s in prefs… one of the auto-complete settings…




> On Feb 3, 2018, at 1:12 PM, David Brostoff  > wrote:
> 
> With BBEdit 12.0.2 (MacBook Pro 2017 15-inch, macOS 10.13.2, ABC - Extended 
> keyboard in System Preferences), whenever I type a double quotation mark, two 
> sets of double quotation marks are displayed.
> 
> In other words, when I type ", the result is "", with the cursor placed 
> between the two quotation marks.
> 
> I think this started with 10.13.
> 
> Maybe a preference needs to be changed?
> 
> Thank you,
> 
> David
> 
> -- 
> 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 
> .
> Visit this group at https://groups.google.com/group/bbedit 
> .





bruce linde
5 happiness webmaster (four more than the competition!)
http://www.5happy.com/ 
http://www.5happy.com/blahg
510.530.1331 office (and best place to leave messages)
510.206.9730 mobile

(shift key available upon request)







-- 
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.
Visit this group at https://groups.google.com/group/bbedit.


Re: Duplicate quotation marks

2018-02-04 Thread @lbutlr
On 3 Feb 2018, at 14:24, Bucky Junior buckyjunior...@gmail.com> wrote:
> Look in Preferences —>Completion —>Insert matching delimiters while typing.
> 
> Selected, it will double the double quotes, single quotes, parentheses, 
> square brackets, curly brackets, and who knows what else. Oh, Barebones knows.

This is a neat feature and I really wish I could get used to it. So far, no 
luck. :/

-- 
Dinosaurs are attacking! Throw a barrel!

-- 
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.
Visit this group at https://groups.google.com/group/bbedit.