Trim grep result to certain characters

2009-09-07 Thread xbsjason

I have a file of names and I want to trim each of them to be no more
than X number of characters, say 20. How can I do this the most
efficient way using GREP or other methods that can do this quickly for
the list? Thanks

--~--~-~--~~~---~--~~
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: Trim grep result to certain characters

2009-09-07 Thread Bill Rowe

On 9/7/09 at 4:52 AM, xbsja...@gmail.com (xbsjason) wrote:

>I have a file of names and I want to trim each of them to be no more
>than X number of characters, say 20. How can I do this the most
>efficient way using GREP or other methods that can do this quickly
>for the list?

Using grep, search on (.(20)).*

and replace with \1


--~--~-~--~~~---~--~~
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: Trim grep result to certain characters

2009-09-07 Thread Todd Ruston

On Sep 7, 2009, at 8:58 AM, Bill Rowe wrote:

> Using grep, search on (.(20)).*


Actually, I think (assuming the list is one name per line) that needs  
be:

(^.{20}).*$

replacing with \1



- Todd



--~--~-~--~~~---~--~~
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: how to script a multi-file search?

2009-09-07 Thread László Sándor
Fellow BBEditors,
I could use Script Debugger 4.5 to explore more of what is going-on with my
search from yesterday and the results. The Explore feature was very useful
to see what AppleScript could find after BBEdit executed my grep "Find All"
search (repeated below for convenience). In short: it does find the search
results browser as I expected. However, the browser window does not provide
all values that the script dictionary knows about. Those would be exactly
what I am trying to extract from the search.

In more detail, after my (complicated) search finding 154 occurrences,
Script Debugger produced this error instead of the values for "contents",
"file", "properties" and "selection" of "search results browser 1": "Get
failed: no such object (e.g. ...) errAENoSuchObject:-1728". For  "document"
and "text" of the same, it told me that "An attempt was made to resolve an
Apple Event reference to a non-existent object (MacOS error
code:-1728)(-1728)".

I would be glad if somebody could tell me what's going on and whether there
is a way out/around.

Thanks again,

Laszlo

PS: My search in AppleScript was:
find "(?<=href=\")((\\S*)(\\.pdf))|((\\S*)(harvard.edu)(\\S*))(?=\")"
searching in front document options {search mode:grep, starting at top:true,
wrap around:false, backwards:false, case sensitive:false, match words:false,
extend selection:false} with selecting match

2009/9/6 László Sándor 

> Hi all,I'm new to both BBEdit and AppleScript, so please forgive my
> ignorance. But let me also say that I spent the better half of my Sunday
> trying to resolve this issue, which also might say something about the
> documentation of BBEdit scripting (or implementation, or a bug).
>
> I wanted to have a script that goes through all the links on a website and
> downloads the pdfs linked in. (FYI, download managers did not work, as the
> course websites at my university require authentication, and somehow only a
> browser could manage that. I'd be glad if, say, DownThemAll would quickly do
> the job in Firefox, but it cannot.)
>
> I have the simple script below to ask for the URL, then grab the source,
> then look for the right pattern. I'm sort of proud having the right grep
> pattern to extract the links. Surprisingly, I could not figure out how to
> use the result coming from BBEdit. The user's manual is almost completely
> silent on the most complicated search-scripting issue (i.e. multi-file
> search), the AppleScript Editor under Snow Leopard cannot open the
> dictionaries of BBEdit or TextWrangler, but even now that Script Debugger
> could, I cannot parse how I could use result of a multi-file search (a bit
> of success/failure or a "search results browser" window ID). I could not use
> search results browser window to do any work.
>
> Thank you for looking into this, any help would be greatly appreciated. I
> am aware of some messages from earlier this year when Jeff tried to do
> something similar, but apparently exchanged three emails with himself on
> this list without resolving the issue. Some clarification could benefit the
> whole community.
>
> Thanks,
>
> Laszlo
>
> The script:
>
> display dialog "What is the URL of the course readings site with the PDF
> links?" default answer ""
> set theURL to the text returned of the result
> tell application "WebKit"
> set the URL of the front document to theURL
>  set theText to the source of front document
> end tell
>
> -- set listOFlinks to {}
> tell application "BBEdit"
>  make new document
> set text of front document to theText
> set fndResults to match list window of (find
> "(?<=href=\")((\\S*)(\\.pdf))|((\\S*)(harvard.edu)(\\S*))(?=\")" searching
> in front document options {search mode:grep, starting at top:true, wrap
> around:false, backwards:false, case sensitive:false, match words:false,
> extend selection:false})
>  -- get properties of fndResults
> -- get contents of fndResults
>  get text of fndResults
> (*
> repeat with i from 1 to count of items in fndResults
>  set this_item to result_file of item i of fndResults
> copy this_item to end of listOFlinks
>  end repeat
> *)
> end tell
>
> tell application "WebKit"
> repeat with i from 1 to count of items in listOFlinks
>  set the URL of the front document to i
> save document 1
> end repeat
> end tell
>
>

--~--~-~--~~~---~--~~
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: LaTeX Clippings does not show up!

2009-09-07 Thread Marek Stepanek

Marek Stepanek wrote:
> 
> 
> Hello all!
> 
> 
> After new install on a new computer, my LaTeX-Clippings does not show up 
> in BBEdit. There is probably something wrong with the Resource Fork. In 
> the Finder this file is shown as a file, to open with Excalibur (! why 
> that? I'am never using it!). In my shell it appears normally as a folder:
> 
> snip
> 
> 
> marek
> 
> 


To answer the question just for the archives: I dragged the folder on 
the desktop, selected it, Cmd + i and I removed the extension .tex ... 
Now it is a folder. And back into the Application 
Support/BBEdit/Clippings Folder. Now the folder is showing as folder in 
the Finder, and this folder is appearing in the clippings menu ...



Best greetings from Munich



marek

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