Re: RegEx 'All Except'?

2012-01-30 Thread Warren Michelsen
On Jan 29, 2012, at 4:15 AM, Jakob Peterhänsel wrote:

 
 Also note: MySQL accept double quotes, so you could also have it like:
 
 (The Riddler's False Notion,87312,1966-04-28T00:00:00Z,null),
 
In the end, I changed the template used to generate the data to have it produc 
double quotes  as field delimiters -- escaped double quotes.

 (\The Riddler's False Notion\,\87312\,\1966-04-28T00:00:00Z\,null),

I was then able to do a pure Applescript find/replace of the apostrophes to 
escape them, following which I unescaped the double quotes before sending the 
text to a do shell script command line for populating the MySQL database.




-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Re: RegEx 'All Except'?

2012-01-29 Thread Warren Michelsen

On Jan 29, 2012, at 4:15 AM, Jakob Peterhänsel wrote:

 Also note: MySQL accept double quotes, so you could also have it like:
 
 (The Riddler's False Notion,87312,1966-04-28T00:00:00Z,null),

That might help but, since the text will be inserted into the database by an 
AppleScript (do shell script...) , I'd have to escape each double quote. 

 /Jakob

Thanks, Jakob.



-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit


RegEx 'All Except'?

2012-01-28 Thread Warren Michelsen
Is there a way in RegEx to say 'replace all of these except...'?

In the following text:

('The Riddler's False Notion','87312','1966-04-28T00:00:00Z',null),
('Scat, Darn Catwoman','87251','1966-03-30T00:00:00Z',null),
('Surf's Up! Joker's Under!','97151','1966-12-28T00:00:00Z',null),
('I'll Be a Mummy's Uncle!','97091','1966-09-28T00:00:00Z',null),
('The Purr-Fect Crime','97091','1966-09-28T00:00:00Z',null),
('Tut's Case Is Shut','97091','1966-09-28T00:00:00Z',null),
('The Devil's Fingers','17031','1967-10-05T00:00:00Z',null);

single-quote characters are used both as field delimiters and as apostrophes. 
So that the text can be inserted into a MySQL database, the apostrophes must be 
escaped (\') (Maybe some other characters as well.)

I wonder if I can use a Regular Expression to do the escaping. 

For example, the text:

('Surf's Up! Joker's Under!','97151','1966-12-28T00:00:00Z',null),

should be changed to:

('Surf\'s Up! Joker\'s Under!','97151','1966-12-28T00:00:00Z',null),

Now, I *could* try to think of every possible letter or letter combination that 
might follow an apostrophe:

's
't
're
etc.

but I might miss some and upon encountering the missed character possibility, 
the text would not be properly escaped.

So, I'm wondering, in RegEx, is there a way to specify change ' to \' in all 
instances EXCEPT where adjacent to a comma or parentheses? That is, I know that 
I need not escape the single-quote characters in these situations:
('
','
',

In those instances, the single-quote is a field delimiter and needed. All other 
instances are indeed apostrophes and need to be escaped.

Can RegEx specify that?



-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Greedy GREP

2011-08-12 Thread Warren Michelsen
I must be misunderstanding how {1}? works.

I have documents that contain three instances of lines starting with time : 

With these documents, I need to do two things:

1) eliminate from the first instance  of ^(time : ) up to but not including the 
second instance; and

2) eliminate the third instance of ^(time : ) and everything after it up to but 
not including the line starting with startTime : 

I would expect (^time : (?s).*) to match the entire document and it does. 

So where do I place the {1}? to limit the find to the second, not third 
instance of ^time : ?

Using (^(time : ){1}?(?s).*)^time selects up to the third ^time.



-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Re: BBEdit 10 cost

2011-07-19 Thread Warren Michelsen
Ummm, here's a question... The BBE license I last recall reading 
permitted two copies of BBEdit to be installed. Back when I ran my 
own server, I had BBE installed both on it and my workstation. That 
made BBE quite a bargain.


Through the app store, isn't the number of Macs that can run a MAS 
app pretty substantial, in many cases making it an even better 
bargain? On most of my Macs, I run the free TextWrangler. I have BBE 
only on my personal workstation. If I but the MAS BBE, I can then 
install the full BBE on those Macs still wrangling text, correct? 
(These Macs are all in my home.)


Talk about a bargain!

--
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.

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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Re: BBEdit 10 cost

2011-07-19 Thread Warren Michelsen

At 4:20 PM -0700 7/19/11, Neil sent email regarding Re: BBEdit 10 cost:

On Jul 19, 12:11 pm, Keith keith.ledbet...@gmail.com wrote:

 So let me get this straight.   I've been a faithful customer for over
 15 years, buying every single BBEdit upgrade.  And yet brand new users
 can buy the product for the exact same price in the AppStore that I
 can upgrade for?  That sucks.


Yes it does. I have always bought the upgrade within days of
announcement.  Not this time.  The changes in BBedit are not required
for the work that I do.  Now I'll wait until either version 9 does not
run or has some feature that I really need.


I have always upgraded even though I use only a small fraction of the 
feature set of BBE. I could (mostly) get by with TextWrangler but I 
always bought the full BBEdit upgrade version-to-version for many 
years. I did it mostly to show support for BareBones and the BBEdit 
product.


I've always gotten great support from BB when I had questions or 
problems and it's well worth the upgrade price with each new version, 
even if I did not need the new features.


Alas, BBEdit 10 requires Mac OS X 10.6 or later and I'm still on 
10.5.8, so, for the fist time since I began using BBEdit, I won't 
upgrade, since I cannot use the new version.


One day, when I abandon Eudora and upgrade to 10.6+, I'll upgrade BBEdit too.

--
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.

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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Re: Delete Table Column X

2011-06-22 Thread Warren Michelsen
At 10:02 AM +0100 6/22/11, John Delacour sent email regarding Re: 
Delete Table Column X:

At 22:50 -0700 21/06/2011, Warren Michelsen wrote:

When run, this warns me that Unix filters require Unix line endings 
and that temp.pl does not have them.


That's odd.  What programme did you use to create the script?


Script Editor Version 2.2.1 (100.1) AppleScript 2.0.1 under OS X 10.5.8.

I didn't have this problem with AppleScript Editor but I can imagine 
Smile or Script Debugger might do this.  In that case you need to 
force Unix line endings, like this:


The Good News is that the script (apparently) had Unix line endings, as it ran.

The Bad News is that it replaced every 1 digit within the selected 
table data with 1 rather than deleted a table column.


--
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.

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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit


First Line of Selection?

2011-06-22 Thread Warren Michelsen
This ought to be very easy. I have html documents containing tables. No colspan 
or rowspan properties are used so each table row has the same number of columns.

The documents are formatted such that each table row is one line in the 
document; the line starts with tr and ends with /tr so that a complete 
row can be selected by selecting a complete line.

Now then, I seem to be having a problem using AS to select the first line of a 
document's selection.  I've tried all kinds of things up to:

set my_line to paragraph 1 of the selection of text document 1 of text 
window 1

I keep getting the error: An attempt was made to resolve an Apple Event 
reference to a non-existent object.

How does one set a variable to the first line of the selected text of the 
front-most BBEdit document window?

All I want to do is get the characters of that first line and count the 
instances of td to determine how many columns the selected table has.

I thought this was going to be easy... 

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Re: Delete Table Column X

2011-06-22 Thread Warren Michelsen

Why does this code as a Unix filter not delete table column 1?

#!/usr/bin/perl
s/(^tr)(td.*?\/td)(td.*?\/td)(td.*?\/td)(\/tr)/\1\3\4\/tr/;
print;

Instead, all selected text is replaced with nothing. What about this 
script is malformed?




--
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.

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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Re: Delete Table Column X

2011-06-22 Thread Warren Michelsen
At 6:03 PM -0400 6/22/11, Ronald J Kimball sent email regarding Re: 
Delete Table Column X:


By the way, you can use a character other than / as the delimiter, to avoid
escaping:

#!/usr/bin/perl -p
s{(^tr)(td.*?/td)(td.*?/td)(td.*?/td)(/tr)}{$1$3$4/tr};


Excellent. Using JD's nifty creation of a temporary filter file, I 
now use AS to get the selection, count the table columns, ask which 
one to delete then build the RegEx based on the column count and 
desired column to be deleted. This gets written to temp.pl in the 
Unix filters directory and called to effect the column deletion.


As always, it was an interesting learning experience. Thanks to those 
who helped out.


--
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.

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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Re: First Line of Selection?

2011-06-22 Thread Warren Michelsen
At 4:30 PM -0500 6/22/11, Christopher Stone sent 
email regarding Re: First Line of Selection?:

On Jun 22, 2011, at 10:52, Warren Michelsen wrote:
 Now then, I seem to be having a problem using 
AS to select the first line of a document's 
selection.  I've tried all kinds of things up 
to:


	set my_line to paragraph 1 of the selection 
of text document 1 of text window 1

__

Hey Warren,

It appears that you want to 'get' rather than 
'select' the first line of the selection.


Ummm..., once I've gotten it, where is it if I don't set something equal to it?



 How does one set a variable to the first line 
of the selected text of the front-most BBEdit 
document window?



It's easy once you figure out which object to 
reference which is not always straightforward in 
Applescript.  :)


 tell application BBEdit
   try
 tell text of front text window
   set my_line to line 1 of selection
 end tell


Seems strange telling something to the text. Very Object Oriented.



   on error errMsg number errNum
 set sep to ==
 set e to sep  return  Error:   errMsg  return  sep  return ¬
Error Number:   errNum  return  sep
 beep
 display dialog e
   end try
 end tell

The new best practice with BBEdit is to 
reference the 'text of the front text window'.


Note that the code above will only provide a 
reference to the line object and not the 
contents thereof.


Noted.



 tell application BBEdit
   tell text of front text window
 set my_line to contents of line 1 of selection
   end tell
 end tell

Or as a one-liner:

 tell application BBEdit to set my_line to 
contents of line 1 of selection of text of front 
text window


That's what I changed to from:

tell application BBEdit
activate -- not taking any chances...
select text window 1
set the_text to the selection
set my_line to line 1 of the_text as text
end tell



HTH.


It does.



--
Best Regards,
Chris


Back atcha.

--
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.

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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Delete Table Column X

2011-06-21 Thread Warren Michelsen
I currently have an AppleScript to delete the third column of a table selected 
within an html doc in BBEdit:

tell application BBEdit
activate
select text window 1
select find window
replace 
(?s)(tr[^]*\\s*(?:td[^]*(?:(?!/td).)*/td\\s*){2})td[^]*(?:(?!/td).)*/td
 using \\1 searching in text 1 of text document 1 options {search mode:grep, 
starting at top:false, wrap around:false, backwards:false, case 
sensitive:false, match words:false, extend selection:false}
end tell

What I'd like to do is present a dialog and ask which column to delete, then 
have the script go and do it. This adds lots of complexity. First off, I need 
to count the columns of the selected table. This seems doable by selecting one 
table row (everything between tr and /tr) and counting the number of tds 
encountered. 

I'm thinking I may have to use the equivalent of a case statement, with 
separate find/replace criteria for the case where the table has two columns, 
three columns, etc. 

Within each case, I may need multiple variations -- one for deleting column 1, 
another for deleting column 2, and so on.

What I'd prefer, of course, is a more generalized solution that can handle any 
number of columns and delete any column designated. So I'm wondering if maybe a 
shell script is the solution. I often employ Perl scripts saved within the 
script application bundle. AS does some prep and then the Perl script is called 
to do the heavy lifting. 

Suggestions?

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Re: Delete Table Column X

2011-06-21 Thread Warren Michelsen
At 11:58 PM +0100 6/21/11, John Delacour sent email regarding Re: 
Delete Table Column X:

At 08:10 -0700 21/06/2011, Warren Michelsen wrote:

What I'd prefer, of course, is a more generalized solution that can 
handle any number of columns and delete any column designated. So 
I'm wondering if maybe a shell script is the solution. I often 
employ Perl scripts saved within the script application bundle. AS 
does some prep and then the Perl script is called to do the heavy 
lifting.


Since I don't think it's possible to pass arguments to a BBEdit Unix 
Filter, you can create the filter using Applescript.


This simple example asks which number you want to replace in the 
front window, and then writes the Unix Filter with this added as a 
variable.  If you type 2 in the dialog, all the 2s will be changed 
to 2.


tell application BBEdit
  activate
  set _dd to display dialog Type a digit? default answer 
  set _number to text returned of _dd
  set _appsup to   (path to application support from user domain)
  set _unixfilters to _appsup  BBEdit:Unix Support:Unix Filters:
  set _perlscript to _unixfilters  temp.pl
  try
close access file _perlscript
  end try
  set _fh to open for access file _perlscript with write permission
  set eof _fh to 0
  write my SCRIPT_TEXT(_number) to _fh
  close access _fh
  run unix filter alias _perlscript
end tell
on SCRIPT_TEXT(_n)
  return #!/usr/bin/perl
my $n = qq~  _n  ~;  
while (){
  s/$n/$n/g;
  print;
}
end SCRIPT_TEXT



When run, this warns me that Unix filters require Unix line endings 
and that temp.pl does not have them.


--
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.

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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Re: Can BBEdit Do This?

2010-11-29 Thread Warren Michelsen
At 1:57 PM -0600 11/28/10, Christopher Stone sent email regarding Re: 
Can BBEdit Do This?:

On Nov 27, 2010, at 18:14, Warren Michelsen wrote:

Is it possible to do this using just BBEdit's Find/Replace and 
such, without resorting to Perl or some other type of script?



__

Hey Warren,

Not really.

Here's a quick and dirty script (assumes dataFile.txt exists on 
the desktop):


Thank you muchly for this but I've decided to go another direction. I 
have a number of droplet AppleScripts that contain a perl script and 
I use these to clean up the data files in question by doing 
find/replace operations independent of BBEdit.


I think I'll adapt one of these to have the contained Perl script 
return the value of a desired datum to the AS and let the AS output a 
text file, or perhaps have the AS tell BBEdit to create a new text 
document with the results returned by the Perl script.


Thanks though, I'll keep and study this for future reference.

--
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.

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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Re: Replace on Different Line Than Find?

2010-11-02 Thread Warren Michelsen
At 8:41 PM -0600 11/1/10, Doug McNutt sent email regarding Re: 
Replace on Different Line Than Find?:


 I confess that I don't know how BBEdit currently handles filters 
that run in perl.  ...


If you use an ordinary Terminal session with the perl code named as 
you indicate you would first make sure your working directory is set 
with chdir and then enter:


perl -w  TitleYear.plPhantom.txt
# -   and later. . .
perl -w  TitleYear.plKong.txt


I use a number of Perl scripts that are embedded within AppleScrip 
wrappers so I can drag and drop files onto them for processing. So 
far though, they've all been simple find/replace. For example:


#!/usr/bin/perl -i

use strict;
use warnings;

local $/;
while ($_ = ) {
#if ($string =~ m/seriesID/)
  {
s/seriesID/seriesId/m;
s/\ =\ /\ :\ /mg;
  }

  print;
}

The above script is in the app bundle that calls the script just once 
with all the dropped files concatenated:


-- We call the perl script one time with the paths of all dropped files
-- concatenated to the command line.

on open dropped_items
	set perlScript to quoted form of (POSIX path of (path to me)  
Contents/Resources/metadata.pl)

set commandLine to perlScript
repeat with this_item in dropped_items
-- we don't want to process .mpg files dropped inadvertently
if (POSIX path of this_item) ends with .txt then
-- add this dropped text file to the command line
			set commandLine to commandLine quoted form of POSIX 
path of this_item

end if
end repeat
do shell script commandLine
end open

I have some other AppleScripts that loop through the dropped files, 
calling the internal Perl script once for each dropped file.






The  redirection operator tells the shell to use the file following 
it to be given to the perl filter as standard input.


AH! I wondered what that was. It's not used in any of my Drag-n-Drop scripts.

Usually, once I can figure out the GREP, I can cobble together 
another AS droplet based on one of my current, functional ones. My 
Perl knowledge is of the Monkey see, monkey do variety so I clone 
one of my scripts that works and modify as needed.


The RegX had me stumped for a while because it seemed like two 
separate searches, one to find the four digits, another to find the 
line to which the digits would be appended.


Then I realized that the digits always come before the target line, 
so it can all be done with one search / replace.


Thanks, I'm sure your examples will help.





--
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.

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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Re: Replace on Different Line Than Find?

2010-11-02 Thread Warren Michelsen
At 8:42 AM +0100 11/2/10, John Delacour sent email regarding Re: 
Replace on Different Line Than Find?:


Here's a way to do it using a UNIX filter on an open BBEdit document:

(Filename: p.pl)

#!/usr/bin/perl
use strict;
my $year;
while (){
  m~^(movieY.+)([0-9][0-9][0-9][0-9])[ \t]?~i and $year =  ($2);
  s~^(title.*)~$1$year~;
  print;
}


Once I figured out the BBEdit Find/Replace, I saved the RegEx within 
BBEdit's Find dialog. Calling from a Unix filter will be a tad more 
convenient. Thanks.


I'll also turn it into an AppleScript droplet. That's my goal.

--
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.

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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Re: Replace on Different Line Than Find?

2010-11-02 Thread Warren Michelsen
At 8:42 AM +0100 11/2/10, John Delacour sent email regarding Re: 
Replace on Different Line Than Find?:


Here's a way to do it using a UNIX filter on an open BBEdit document:

(Filename: p.pl)

#!/usr/bin/perl
use strict;
my $year;
while (){
  m~^(movieY.+)([0-9][0-9][0-9][0-9])[ \t]?~i and $year =  ($2);
  s~^(title.*)~$1$year~;
  print;
}


As expected, the above works as a Unix filter in BBEdit.

This line:
m~^(movieY.+)([0-9][0-9][0-9][0-9])[ \t]?~i and $year =  ($2);
appears to set the var $year to the four digits within parentheses. 
What does the [ \t]?~i  part do?


In terminal, the output goes to STDOUT. How would I get it to replace 
in place, updating the file?


--
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.

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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Replace on Different Line Than Find?

2010-11-01 Thread Warren Michelsen
Is it possible within BBEdit to do a Find getting text from one line and them 
do another find/replace to append the original found text to the second found 
line? I.e., can BBEdit hold found text for later use?

If not, then I need some Perl help. 

Within each file passed to the Perl script, I want to find the line beginning 
movieYear :  and get the four digits following the space and before the line 
end character.


^movieYear : (\d{4})

I need to append a space and the four digits (within parentheses) to the end of 
the line beginning title : 

So, if I call the Perl script:

/path/to/perl/script.pl /path/to/Phantom.txt /path/to/Kong.txt

and if the files passed to the script contain among their lines



Phantom.txt
some text
More text
movieYear : 1925
additional lines of text
title : The Phantom of the Opera
more lines


Kong.txt
some text
More text
movieYear : 1933
additional lines of text
title : King Kong
more lines


I need the script to produce:


Phantom.txt
some text
More text
movieYear : 1925
additional lines of text
title : The Phantom of the Opera (1925)
more lines


Kong.txt
some text
More text
movieYear : 1933
additional lines of text
title : King Kong (1933)
more lines


Anyone care to lend a hand?


-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Re: Replace on Different Line Than Find?

2010-11-01 Thread Warren Michelsen
At 7:58 AM -0700 11/1/10, Warren Michelsen sent email regarding 
Replace on Different Line Than Find?:
Is it possible within BBEdit to do a Find getting text from one line 
and them do another find/replace to append the original found text 
to the second found line? I.e., can BBEdit hold found text for later 
use?


If not, then I need some Perl help.



It looks like, in the files I need to process, the movieYear line 
always precedes the title line so that I can use BBEdit to:




Find:
(^movieYear : )(\d{4})((?s).+)(^title : )(.*$)

Replace
\1\2\3\4\5 \(\2\)

How would I express this particular find/replace in a Perl script?





Within each file passed to the Perl script, I want to find the line 
beginning movieYear :  and get the four digits following the space 
and before the line end character.


^movieYear : (\d{4})

I need to append a space and the four digits (within parentheses) to 
the end of the line beginning title : 


So, if I call the Perl script:

/path/to/perl/script.pl /path/to/Phantom.txt /path/to/Kong.txt

and if the files passed to the script contain among their lines



Phantom.txt
some text
More text
movieYear : 1925
additional lines of text
title : The Phantom of the Opera
more lines


Kong.txt
some text
More text
movieYear : 1933
additional lines of text
title : King Kong
more lines


I need the script to produce:


Phantom.txt
some text
More text
movieYear : 1925
additional lines of text
title : The Phantom of the Opera (1925)
more lines


Kong.txt
some text
More text
movieYear : 1933
additional lines of text
title : King Kong (1933)
more lines

Anyone care to lend a hand?



--
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.

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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Re: Replace on Different Line Than Find?

2010-11-01 Thread Warren Michelsen
At 1:05 PM -0600 11/1/10, Doug McNutt sent email regarding Re: 
Replace on Different Line Than Find?:

!/usr/bin/perl
undef $/; # Tell perl to ignore line ends in the input.
$thetext = STDIN;  # read the whole document from standard input.
$e = \n;  # Make it clear which line ends your document has in it. 
You might want \r or \r\n.
# Do the substitutions (s///) using the s flag to include line ends 
and the g flag to repeat.

#begin single line that hopefully didn't get shortened by email.
$thetext =~ s/${e}movieYear : (\d\d\d\d)${e}(.*?)${e}title : ([\w 
]*?)${e}/${e}movieYear : $1${e}$2${e}title : $3 \($1\)${e}/sg;

#end single line
print $thetext;  # report the result to standard output.
__END__


I'm sure this will work splendidly, if only I knew what you were saying...

So, if I save the above script as TitleYear.pl and have two text 
files to process, Phantom.txt and Kong.txt, how, exactly, would I 
invoke it?



path/to/TitleYear.pl -w Phantom.txt Kong.txt

?






Call perl like this.
perl -w filename.pl  filename.pl

Phantom.txt
some text
More text
movieYear : 1925
additional lines of text
title : The Phantom of the Opera
more lines

Kong.txt
some text
More text
movieYear : 1933
additional lines of text
title : King Kong
more lines



--
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.

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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.

Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Re: Flip a Table

2010-07-06 Thread Warren Michelsen

At 9:41 AM +0100 7/6/10, John Delacour sent email regarding Re: Flip a Table:

At 17:49 -0700 5/7/10, Warren Michelsen wrote:


Is this a Perl script? Should it start with:
#!/usr/bin/perl


Yes; and no, it makes no difference if it is run as a UNIX filter in BBEdit.

JD


When put unto: ~/Library/Application Support/BBEdit/Unix 
Support/Unix Scripts/Reverse Lines and run from the shebang menu -- 
Unix Scripts, I get:
This file doesn't appear to contain a valid 'shebang' line 
(application error code: 13304)


So, this is why I asked.


--
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.

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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.


Re: Flip a Table

2010-07-06 Thread Warren Michelsen
At 12:56 PM -0400 7/6/10, Patrick Woolsey sent email regarding Re: 
Flip a Table:


Both filters and scripts must start with a valid shebang line.


Which is entirely reasonable.

Adding the shebang line, while it eliminates the error message, does 
not make the script do anything. The script appears to do nothing. No 
errors, no change to the front-most BBEdit doc with the selected 
lines.


I selected the lines I want to reverse within the front-most BBEdit 
doc, then selected the JD script from the menu. Nada.


Am I using the script incorrectly?

--
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.

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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.


Re: Flip a Table

2010-07-06 Thread Warren Michelsen

At 2:44 PM -0400 7/6/10, Patrick Woolsey sent email regarding Re: Flip a Table:

At 10:11 -0700 07/06/2010, Warren Michelsen wrote:

[...]

I selected the lines I want to reverse within the front-most BBEdit
doc, then selected the JD script from the menu. Nada.

Am I using the script incorrectly?



Please make sure you're applying this code as a filter.

Specifically, it should be stored in the Unix Filters folder:

~/Library/Application Support/BBEdit/Unix Support/Unix Filters/

and applied via #! - Unix Filters - scriptfile.pl or from the Unix
Filters palette.


OK, that works. Thanks muchly to you and JD.

--
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.

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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.


Flip a Table

2010-07-05 Thread Warren Michelsen
I have tables containing data in reverse chronological order. I'd like it to be 
chronological so I'm thinking I can just move the table rows around.

Seems like it would require a separate scratch file to hold the re-ordered rows 
until all rows have been copied, then replace the selection with the re-ordered 
rows.

I.e., Take the last table row (cutting or removing it) from the selection and 
move it to the scratch area.

Take the last table row and move it to the end of the scratch area. 
Lather, rinse, repeat until all rows have been cut from the original
Then move the scratch contents to the original document.

I'm guessing that Perl is the best tool for this job. It has a reverse function 
so I'm guessing that the original selection could be read into an array, using 
tr and /tr as delimiters, then regurgitated in reverse order of the 
original.  


Anyone have something like this lying around or an example showing how to get 
table rows into an array?


-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.


Re: Flip a Table

2010-07-05 Thread Warren Michelsen

At 9:48 PM +0100 7/5/10, John Delacour sent email regarding Re: Flip a Table:

At 10:37 -0700 5/7/10, Warren Michelsen wrote:

...I'm guessing that Perl is the best tool for this job. It has a 
reverse function so I'm guessing that the original selection could 
be read into an array, using tr and /tr as delimiters, then 
regurgitated in reverse order of the original.



How you do it will depend on where your line-breaks are.  If your file reads

tr1/tr
tr2/tr
tr3/tr
tr4/tr
tr5/tr

then it is simple.  Just write the following little routine, select 
the lines in the document you want to reverse and run the script.



#UNIX SCRIPT:


Is this a Perl script? Should it start with:
#!/usr/bin/perl

?





while () {
  chomp;
  push @_, $_
}
for (reverse @_){
  next if /^$/; # ignore blank lines
  print $_\n;
};

Run the above script from the palette or with a key-shortcut to get:



--
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.

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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.


Re: Flip a Table

2010-07-05 Thread Warren Michelsen

At 12:48 PM -0700 7/5/10, Bill Rowe sent email regarding Re: Flip a Table:

This can be done in BBEdit with out a separate scratch file as follows:

Go to Text-Add/Remove Line Numbers...

Add suitable line numbers to the lines you want to reverse the order 
of with a space between the line number and data you want retained.


Then to to Text-Sort Lines...

Select Numbers match by value and Reverse sort. Finally go back to 
Add/Remove Line Numbers... to remove the line numbers previously 
added.


The result will be a reverse order of the data.


Just had to format compact first and replace /tr with /tr\r to 
get each row on its own line, then this add/remove line numbers trick 
worked fine.


Much less hassle than dragging and dropping multiple table rows one at a time!

--
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.

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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.


Re: Delete Entire Table Column

2010-03-21 Thread Warren Michelsen
At 7:30 PM -0400 3/21/10, Ronald J Kimball sent email regarding Re: 
Delete Entire Table Column:

On Sun, Mar 21, 2010 at 07:23:35PM -0400, Ronald J Kimball wrote:


 Find


(tr[^]*\s*(?:td[^]*(?:(?!/td).)*/td\s*){2})td[^]*(?:(?!/td).)*/td

 Replace

 \1



Oops, I forgot the (?s)...

(?s)(tr[^]*\s*(?:td[^]*(?:(?!/td).)*/td\s*){2})td[^]*(?:(?!/td).)*/td

Ronald


Alas, in a table with over 100 rows, BBEdit runs out of stack space:
out of stack space (application error code: 12246)
This happens with a Replace All and with repeated Replace and Find 
(one at a time).


--
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.

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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.


To unsubscribe from this group, send email to bbedit+unsubscribegooglegroups.com or reply 
to this email with the words REMOVE ME as the subject.


Grep Help

2010-01-17 Thread Warren Michelsen
I need to search for a td/td tag set and everything in between, which may 
include line breaks but which must include an anchor.

td
a   href=http://URL.WILL.BE.HERE;Link 
Text here
/td
 
I need to find and replace this entire table column. (Replacing with  so as 
to delete.)

What's the Grep pattern to find this?

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
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 feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.

Re: Multi-line, Non-Greedy GREP Find

2009-08-19 Thread Warren Michelsen

At 1:36 PM -0400 8/19/09, Ronald J Kimball sent email regarding Re: 
Multi-line, Non-Greedy GREP Find:
On Wed, Aug 19, 2009 at 10:24:29AM -0700, Warren Michelsen wrote:

  How do I get this pattern to stop after finding the first /td tag? I
  want to replace td tags that span multiple lines.

  td class=redline([\s\S]*)/td

The simplest way is by using a non-greedy quantifier:

td class=redline([\s\S]*?)/td

I thought the non-greedy qualifier had to be associated with the 
close tag and therefore after the closing parentheses. I tried 
putting it all kinds of places, except inside the parentheses.


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



Re: sftp as root

2009-08-17 Thread Warren Michelsen

At 3:56 PM +1000 8/17/09, Charlie Garrison sent email regarding Re: 
sftp as root:
Good afternoon,

On 16/08/09 at 9:24 AM -0700, Warren Michelsen
wmichel...@gmail.com wrote:

Charlie, are you saying you were able to sftp as root with no
  password and it worked?
...
I can connect via sftp using BBEdit with the root account. It
works fine for me.

With no password?


If you can ssh to the machine as root, then you should be able
to connect as root from with BBEdit.

That was my expectation.


So I'd be very curious to know if anyone can successfully
connect via BBE's sftp as root with no password.

I can, so that's at least one. I throw a question back; are you
able to connect as root (without password) via ssh from the
command line?

Yes.

Previously I would ssh to the server in question (in Terminal) as 
other than root then su to root (or sudo) to edit configuration and 
other files that I could not edit without being root. But I would 
like the convenience of BBEdit's features when editing such files. 
Since sftp cannot 'su' to root, I enabled the root account and set 
it, as I did my other account, to use keys for password-less log-in.

ssh from Terminal works just fine. I'd expected that just leaving out 
the password when sftp'ing as root would Just Work but it doesn't, 
and I'm puzzled.

I can use passwordl-ess sftp using another non-root account. Root 
seems to be treated differently.

I was watching both secure.log and system.log while trying to get BBE 
to log in as root without a password over a network connection.

Here's what secure.log showed:

Aug 14 11:08:22 smtp com.apple.SecurityServer: authinternal failed to 
authenticate user root.
Aug 14 11:08:22 smtp com.apple.SecurityServer: Failed to authorize 
right system.login.tty by process /usr/sbin/sshd for authorization 
created by /usr/sbin/sshd.
Aug 14 11:08:22 smtp com.apple.SecurityServer: authinternal failed to 
authenticate user root.
Aug 14 11:08:22 smtp com.apple.SecurityServer: Failed to authorize 
right system.login.tty by process /usr/sbin/sshd for authorization 
created by /usr/sbin/sshd.
Aug 14 11:08:22 smtp com.apple.SecurityServer: authinternal failed to 
authenticate user root.
Aug 14 11:08:22 smtp com.apple.SecurityServer: Failed to authorize 
right system.login.tty by process /usr/sbin/sshd for authorization 
created by /usr/sbin/sshd.

here's what system.log showed:

Aug 14 11:08:22 smtp DirectoryService[160]: Failed Authentication 
return is being delayed due to over five recent auth failures for 
username: root.
Aug 14 11:08:22 smtp sshd[19730]: error: PAM: Authentication failure 
for root from [my.ip]
Aug 14 11:08:22 smtp sshd[19730]: error: PAM: Authentication failure 
for root from [my.ip]
Aug 14 11:08:22 smtp sshd[19730]: error: PAM: Authentication failure 
for root from [my.ip]


So, I suspect that hacker/attackers are attempting to log in as root 
and running up this counter which has a limit of 5.

What is curious is, of course, that I can ssh as root successfully 
via Terminal and the 5-limit does not affect me.

Do normal ssh and ssh tunnels use different authentication? Does 
normal ssh not use PAM?

Any suggestions as to what I should watch/monitor while attempting 
BBE's sftp as root would be appreciated.







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



shell, perl script to count identical lines?

2009-08-17 Thread Warren Michelsen

Does anyone have a shell or Perl script for BBEdit which will count identical 
lines in the front-most document and report the results?

Ideally, create a new text document with a listing of each unique line and the 
number of instances of that line, perhaps preceding that line so the results 
can be sorted by number of occurrences.

I've distilled my DNS server query log down to just the domain looked up and 
the type query (eliminating date, time, querying IP, etc.). Now I'd like to get 
a count of the lookups to see which are looked up most often.

I have a 'Count Identical Lines' AppleScript but with 1,112,000+ lines to be 
counted, I don't even want to attempt it.


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



Re: shell, perl script to count identical lines?

2009-08-17 Thread Warren Michelsen

At 10:28 AM -0500 8/17/09, Fritz Anderson sent email regarding Re: 
shell, perl script to count identical lines?:
On 17 Aug 2009, at 10:19 AM, Warren Michelsen wrote:

  Does anyone have a shell or Perl script for BBEdit which will count 
  identical lines in the front-most document and report the results?

man uniq

Aha!

#!/bin/sh
uniq -c $1

does the trick. Man, I love Unix. (and BBEdit.)




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



Re: sftp as root

2009-08-16 Thread Warren Michelsen

At 6:00 PM +1000 7/16/09, Charlie Garrison sent email regarding Re: 
sftp as root:
Good afternoon,

On 16/07/09 at 12:49 AM -0700, Warren Michelsen
wmichel...@gmail.com wrote:

How do I get BBEdit to use sftp as the root user with no password?

Enter 'root' for username, and leave password blank. I don't use
BBEdit for sftp but I was curious if use of ssh keys was
automatic. I tested it now and it just worked (as expected).

Charlie, are you saying you were able to sftp as root with no 
password and it worked?

I can do it as other than root, but not as root. Did you do it as root?

I was told elsewhere:

SSH and SFTP are quite different protocols.  I suspect the problem 
is that SSH establishes a terminal connection entirely within sshd. 
SFTP uses an SSH tunnel to ftpd.  Ftpd has its own set of access 
restrictions one of which is you can't connect as root.

So I'd be very curious to know if anyone can successfully connect via 
BBE's sftp as root with no password.


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



Re: sftp as root

2009-07-19 Thread Warren Michelsen

At 5:17 PM -0400 7/16/09, Patrick Woolsey sent email regarding Re: 
sftp as root:
you wrote:
[...]
After I click the connect button, BBEdit says: Opening sftp
connection and puts up an additional password dialog. Entering the
password does not log me in.


What app version are you running?

version 9.2.1 (2532) of Fri, 19 Jun 2009


Trying to sftp to my server as root using passwordless public key 
authentication.

Previously, I used sftp with passwords, until I set up ssh using 
keys, no passwords.

Now that I should be able to connect with no password, BBE won't let 
me delete the passwords from the ftp settings. I click to Change 
the ftp settings, remove the password and tell it to Save. When next 
I open that setting, the password is back.

I tried completely deleting the connection setting and recreating it 
with no password. When I selected the re-created setting to Change 
it had a password. I think it's looking in Keychain and fetching the 
password for that user/host and inserting that password.

So I deleted that password from keychain. Now each time I select that 
ftp bookmark, BBE pops up a separate dialog asking: Password for 
r...@[hostname] with Cancel and (disabled) OK button. Apparently, if 
I hit Cancel, it won't even bother to try connecting.

I do not have this problem with a non-root account that also uses 
public key authentication. root seems to behave differently or be a 
special case.

Yes, I can ssh as root to the host in question using Terminal.

Secure.log on the host has no logged attempts from my IP address so I 
have to think that, sans a password, BBE doesn't even attempt to 
connect as root.

System.log, however, says:

Jul 19 17:11:38 smtp DirectoryService[65]: Failed Authentication 
return is being delayed due to over five recent auth failures for 
username: root.
Jul 19 17:11:38 smtp sshd[14379]: error: PAM: Authentication failure 
for root from [my.public.hostname]
Jul 19 17:11:38 smtp sshd[14379]: error: PAM: Authentication failure 
for root from [my.public.hostname]
Jul 19 17:11:38 smtp sshd[14379]: error: PAM: Authentication failure 
for root from [my.public.hostname]


Who is this Pam and why is she preventing me from logging in?  ;-)






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



sftp as root

2009-07-16 Thread Warren Michelsen

I'm trying to log into my server from my workstation over the Internet using 
BBEdit's sftp. Is sftp done in a ssl tunnel? What are the requirements on the 
remote server to enable me to log in, encrypted, as root to manage 
configuration files and such?

I normally ssh to the server in Terminal (passwordless via RSA keys) and then 
su to root, if needed. I'd like to be able to use BBEdit instead of Terminal 
and pico. 

So I've set the server to allow passwordless log-in by root using a key.

How do I get BBEdit to use sftp as the root user with no password?

Or is sftp the wrong mechanism? Can I tunnel BBEdit's connection in ssh or 
some such?

Bottom line: I want BBEdit to connect and edit files on my server as root, 
using my public key instead of a password. Can I do that? 

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



Re: sftp as root

2009-07-16 Thread Warren Michelsen

At 6:00 PM +1000 7/16/09, Charlie Garrison sent email regarding Re: 
sftp as root:
Good afternoon,

On 16/07/09 at 12:49 AM -0700, Warren Michelsen

So I've set the server to allow passwordless log-in by root using a key.

Have you tested that from command line? If it works there it
should work from BBEdit.

Works from CLI, BBEdit asks for my password.


You should be able to. If ssh works for passwordless root login
from command line, then it should work in BBEdit as well.

After I click the connect button, BBEdit says: Opening sftp 
connection and puts up an additional password dialog. Entering the 
password does not log me in.


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



Scripting Find/Replace in All Open Documents

2009-06-23 Thread Warren Michelsen

What's the correct searching in... syntax for all open text documents? 

I'm trying to script a Find/Replace operation that would apply to whatever docs 
are open. When I recorded the action, each file was separately listed. How do I 
specify all open text documents so as to make this generic and applicable to 
whatever files are currently opened?




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



Move a Text Line to the Start

2009-05-17 Thread Warren Michelsen

Given a text document containing a number of lines separated by line breaks, I 
need to find a particular line and move it to the start of the document.

Seems like a strategy would be to find the entire document in three parts: 
the lines before the target line
the target line
the lines following the target line. 

Then just replace with \2\1\3

If, for example, the target line is: 
startTime.*/startTime
how do I make it the middle part of the found text?




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



Scripting Find and Copy Here, Paste Elsewhere?

2009-05-13 Thread Warren Michelsen

Is there a way to script BBEdit to find text in one place, copy a part of it 
then find text elsewhere and paste the previously copied text into the other 
found text? Multiple times?

I am downloading hundreds of recordings from my TiVo DVRs and each is 
accompanied by a text file of metadata. One line in that text file will be of 
the form:

originalAirDate : 2009-04-06T00:00:00Z

in this line, I'm interested in the 10 characters in -MM-DD format. I need 
to copy those characters and paste them elsewhere in the document.

There are *other* occurrences of dates in -MM-DD format and I want to 
replace each of those with the year-Month-Day copied from the first 
(originalAirDate) Find operation. 

I want to script this. I can find the first -MM-DD and copy it using:
Find: (originalAirDate : )(?Porig\d\d\d\d-\d\d-\d\d)

but how do I hold onto \Porig so I can do the subsequent Find operations and 
use it (\Porig) as the replacement text? (There will typically be three more 
occurrences of the -MM-DD format.

Of course, I could probably do a whole folder of such files in a few seconds 
using Perl or some-such, if I knew Perl...

Would someone care to help me with 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.
-~--~~~~--~~--~--~---



PHP Formatting, Syntax Checking, Pasting Non-Breaking Spaces

2009-03-31 Thread Warren Michelsen

Does BBEdit have the ability to format and syntax check php code as it does 
html code? Is there a hidden php palette somewhere that I have yet to find?

And, as long as I've got your attention, when I use sites like 
http://www.phpformatter.com/ the output code comes back formatted using 
non-breaking spaces for padding. When copied and pasted into a BBEdit doc, the 
presence of non-breaking spaces breaks the code. I wondered why my code would 
break each time I formatted it, even though the only (visible) difference 
between before and after was white space. 

It turns out that, if I use Firefox or SeaMonkey with these code formatter 
sites, when I copy/paste, the non-breaking spaces are changed to plain old 
spaces. The code does not break. Other browsers copy the non-breaking spaces to 
the clipboard.

No that I know of the problem, it's a simple enough matter to find/replace to 
fix the spaces. But is there a setting somewhere in BBEdit that can 
automatically change to spaces when pasting non-breaking spaces? If not, might 
this be a reasonable option to add to the Editor defaults (right in there with 
auto indenting and smart quotes?

Of course, I wouldn't have to use php/Javacsript/etc formatter sites if I had 
this functionality within BBEdit...




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



Re: Index within a Text Factory?

2009-03-01 Thread Warren Michelsen

At 9:32 AM -0500 2/28/09, Rich Siegel sent email regarding Re: Index 
within a Text Factory?:
On 2/27/09 at 10:48 PM, wmichel...@gmail.com (Warren Michelsen) wrote:

  But I'm still curious to know if there exists a mechanism to
  auto-increment an index in a text factory. I'd had other occasions
  when I wanted to number lines and such. Is there a way to do so?

For numbering lines specifically, there's the Add/Remove Line 
Numbers action...

And for others?

Here's a suggestion. In the text factory, how about a token of some 
kind that can be optionally inserted. It would be initialized in the 
text factory options (initial value, increment) and we could place it 
into the prefix, suffix, or whatever other places within text 
factories that make sense.

I certainly would find it handy...

Tokens for other things might be handy too.


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



Re: Index within a Text Factory?

2009-02-28 Thread Warren Michelsen

At 2:37 PM -0800 2/27/09, Dennis  Whiteman sent email regarding Re: 
Index within a Text Factory?:
On Feb 27, 12:51 pm, Warren Michelsen wmichel...@gmail.com wrote:
  INSERT INTO `tablename` VALUES (1, 'Item one');
  INSERT INTO `tablename` VALUES (2, 'the second item');

If that field is the primary key and set to auto-increment in MySQL,
you can have the database automatically increment the numbers...

Wonderful. Yes, the first field is the primary key  and set to auto_increment.


INSERT INTO `tablename` (`field2`) VALUES ('Item one');
INSERT INTO `tablename` (`field2`) VALUES ('the second item');

Thanks, I'll do it that way.

But I'm still curious to know if there exists a mechanism to 
auto-increment an index in a text factory. I'd had other occasions 
when I wanted to number lines and such. Is there a way to do so?


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



Re: Index within a Text Factory?

2009-02-28 Thread Warren Michelsen

At 9:32 AM -0500 2/28/09, Rich Siegel sent email regarding Re: Index 
within a Text Factory?:
On 2/27/09 at 10:48 PM, wmichel...@gmail.com (Warren Michelsen) wrote:

  But I'm still curious to know if there exists a mechanism to
  auto-increment an index in a text factory. I'd had other occasions
  when I wanted to number lines and such. Is there a way to do so?

For numbering lines specifically, there's the Add/Remove Line 
Numbers action...

Well, yeah. Bad example. I typically need to insert an incremented 
number in mid-line somewhere. Is there maybe a way to do this with 
GREP? Say, find xxx and replace with xxx[index]?


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



Index within a Text Factory?

2009-02-27 Thread Warren Michelsen

I've been converting plain text lists for importation into a MySQL database. 
The text file lines look like this:

INSERT INTO `tablename` VALUES (1, 'Item one');
INSERT INTO `tablename` VALUES (2, 'the second item');

and so on. Note that the first field is an integer that needs to be incremented 
for each new line. Can this be done within a Text factory?

I was getting ready to try a Text Factory (my first time) and don't see an 
option or way to add an index when using the Prefix/Suffix action.




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