On Aug 27, 2012, at 00:47, gugus2000 <[email protected]> wrote: > How can I remove lines from a large file that do not contain a certain > pattern? I can easily find the lines with the pattern but then...? The way I > do it today is using grep on the command line with io-redirection but I think > there should be a way to do it from within BBEdit. ______________________________________________________________________
Hey Markus, Currently there is no way to do that directly with BBEdit. Please make a feature request to support: Bare Bones Software <[email protected]> The more of us who do the more likely they'll listen. Personally I think the inversion switch should be included in the Process Duplicate Lines dialog, but I made my formal request some time ago. In the meantime it's pretty easy to roll-your-own: ------------------------------------------------------------------------------------------------ try tell application "BBEdit" tell me to set ddStr to text returned of (display dialog "Enter grep pattern:" default answer "" giving up after 120) if ddStr ≠ "" then set _text to quoted form of (get text of front text window) set shellCMD to "echo " & _text & " | tr '\\r' '\\n' | egrep -iv " & "\"" & ddStr & "\"" set filteredText to do shell script shellCMD make new text document with properties {text:filteredText} end if end tell on error eMsg number eNum set {c, s} to {return, "------------------------------------------"} set e to s & c & "Error: " & eMsg & c & s & c & "Error Number: " & eNum & c & s beep set dDlg to display dialog e buttons {"Cancel", "Copy", "OK"} default button "OK" if button returned of dDlg = "Copy" then set the clipboard to e end if end try ------------------------------------------------------------------------------------------------ I've got case-sensitive set OFF in the script. -- Best Regards, Chris -- -- 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 [email protected] To unsubscribe from this group, send email to [email protected] 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 "[email protected]" rather than posting to the group. Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
