Em 1/21/07 11:48 PM, "Tom Young" <[EMAIL PROTECTED]> escreveu:
> I'm currently looking at a most simple one to pick out special > numbers from a documents > > search pattern: BS [\d]+ > > [snip] > > In Terminal that would seem to be egrep -o "searchpattern" File > > newFile > > But it doesn't work > > why not? Try using: BS [0-9]+ Instead of BS [\d]+ Standard grep (and egrep) don't recognize \d as a shortcut to [0-9]. You should use the -P option, to force grep to use Perl regular expressions (which accepts the \d shortcut for digits), but for some reason the -P option is disabled in OS X. BTW, in your original pattern, the brackets are optional. You could use simply: BS \d+ The brackets are required only when you need to match more than one character. For instance: [abc] matches a or b or c [\d\t]+ matches one or more digits or TABs But if you want to match only one character, you don't need brackets: [a] matches a a also matches a [\d]+ matches one or more digits \d+ also matches one or more digits Obviously, the above hints don't apply to your egrep pattern, since it doesn't allow \d. But you can use this hint to build more legible grep patterns in BBEdit. Hope it helps. João Carlos de Pinho São Paulo, Brazil -- ------------------------------------------------------------------ Have a feature request? Not sure the software's working correctly? If so, please send mail to <[EMAIL PROTECTED]>, not to the list. List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml> List archives: <http://www.listsearch.com/BBEditTalk.lasso> To unsubscribe, send mail to: <[EMAIL PROTECTED]>
