I've written a little command to help me grep the current file and copy matching lines to a new document. I've copied the example of "Search the TextMate Mailing List" for the CocaoDialog. However my implementation is stalling and I need to killall CocaoDialog to free it up.
Save: Nothing Input: Selection Output: Create new document
---
res=$(CocoaDialog inputbox \ --title "Find matching lines" \ --informative-text "Regular expression to match lines:" \ --button1 "Find" --button2 "Cancel")
[[ $(head -n1 <<<"$res") == "2" ]] && exit_discard pattern=$(tail -n1 <<<"$res")
perl -ne "print if /$pattern/";
The only thing much different here from the "Search mailing list" code is the use of stdin.
Hmmmm?
Q