Exporting Patterns

498 views
Skip to first unread message

JT

unread,
May 27, 2012, 9:33:28 PM5/27/12
to BBEdit Talk
Hi, could someone tell me if there is a way to export the saved grep
patterns in bbedit? Want to make sure I don't lose all my patterns in
the event I have to do a fresh install.

Fritz Anderson

unread,
May 27, 2012, 10:38:07 PM5/27/12
to bbe...@googlegroups.com
The answer to nearly everything is in

~/Library/Application Support/BBEdit

In this case,

~/Library/Application Support/BBEdit/Setup/Grep Patterns.xml

It's actually a property list file. If you're using the whizzy Dropbox support, the answer to nearly everything is in

~/Dropbox/Application Support/BBEdit

— F

--
Fritz Anderson
Xcode 4 Unleashed: learn to break concrete with the strength of your will.
<http://x4u.manoverboard.org/>

Christopher Stone

unread,
May 28, 2012, 4:00:28 PM5/28/12
to bbe...@googlegroups.com
On May 27, 2012, at 20:33, JT wrote:
Hi, could someone tell me if there is a way to export the saved grep patterns in bbedit? Want to make sure I don't lose all my patterns in the event I have to do a fresh install.
______________________________________________________________________

Hey JT,

Having a fresh backup of BBEdit's app-support folder and its prefs is desirable of course, but if you want a nice readable export give this Applescript a try.

------------------------------------------------------------------------------
set patternFile to "~/Library/Application Support/BBEdit/Setup/Grep Patterns.xml"
set patternFile to do shell script "echo " & patternFile
tell application "System Events"
tell property list file patternFile's property list item "SavedGrepPatterns"
set SavedGrepPatterns to value of property list items
end tell
end tell
set patternList to {}
repeat with i in SavedGrepPatterns
tell (contents of i)
set end of patternList to "         Title:  " & its Title
set end of patternList to " SearchPattern:  " & its SearchPattern
set end of patternList to "ReplacePattern:  " & its ReplacePattern
set end of patternList to ""
end tell
end repeat
set AppleScript's text item delimiters to return
set patternList to patternList as text
tell application "BBEdit"
activate
make new document with properties {text:patternList}
end tell
------------------------------------------------------------------------------

--
Best Regards,
Chris

Reply all
Reply to author
Forward
0 new messages