3 ms·
GNU and BSD grep both default to "basic" regular expressions and both have the `-E` switch to use "extended" expressions.
by alwaysbeconsing 3y ago
GNU and BSD grep both default to "basic" regular expressions and both have the `-E` switch to use "extended" expressions.
- shortrounddev2 3y agoLast time I used macOS (which was 6 years ago) there was no extended expressions, or the regex syntax was limited. I forget (again, haven't used an apple product in years)
- alwillis 3y agoIt's not necessary to install a suite of commands if you want updated grep. Just use Homebrew and you can install different versions of grep, including GNU's: brew install grep
- shortrounddev2 3y agoSure but with this you get all the other improved core utils like sed, etc. GNU utils just blow BSD/macOS out of the water. Personally, macOS seems to me like a half baked development platform in general
- alwillis 3y agoSome of us don't want all of GNU's utilities; just on an as-needed basis. They're not as needed as they once were. Many of these utilities have been rewritten in Rust and have more modern features and are faster. For example, instead of ls, I use exa [1]. Or ripgrep [2] instead of grep. sd [3] instead of sed. [1]: https://github.com/ogham/exa https://github.com/ogham/exa [2]: https://github.com/BurntSushi/ripgrep https://github.com/BurntSushi/ripgrep [3]: https://github.com/chmln/sd https://github.com/chmln/sd