Thursday, May 29, 2014

Logical Expressions with OSX grep

Show me a simple, working example of how to use logical expressions with the grep command that comes with OSX.

Crickets.

Problem

OSX Grep Sucks.

Solution

Replace OSX grep with GNU grep.

$ brew tap homebrew/dupes
$ brew install homebrew/dupes/grep
$ brew install pcre
$ alias grep='ggrep'
$ grep --version
ggrep (GNU grep) 2.18
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later .
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Haertel and others, see .


Try it out


$ npm outdated | grep -E 'uglify|html'

uglify-js                          1.3.3     1.3.3     2.4.13  grunt-modernizr > uglify-js
maxmin                             0.1.0     0.1.0      0.2.0  grunt-contrib-uglify > maxmin
strip-ansi                         0.1.1     0.1.1      0.2.1  grunt-contrib-uglify > chalk > strip-ansi
async                             0.2.10    0.2.10      0.9.0  grunt-contrib-uglify > uglify-js > async
optimist                           0.3.7     0.3.7      0.6.1  grunt-contrib-uglify > uglify-js > optimist
readable-stream                 1.1.13-1  1.1.13-1   1.0.27-1  grunt-contrib-jshint > jshint > htmlparser2 > readable-stream
entities                           1.0.0     1.0.0      1.1.1  grunt-contrib-jshint > jshint > htmlparser2 > entities
strip-ansi                         0.1.1     0.1.1      0.2.1  grunt-contrib-htmlmin > chalk > strip-ansi
glob                               3.2.9     4.0.0      4.0.0  grunt-contrib-htmlmin > html-minifier > cli > glob
commander                          2.1.0     2.1.0      2.2.0  grunt-contrib-htmlmin > html-minifier > clean-css > commander
async                             0.2.10    0.2.10      0.9.0  grunt-contrib-htmlmin > html-minifier > uglify-js > async
optimist                           0.3.7     0.3.7      0.6.1  grunt-contrib-htmlmin > html-minifier > uglify-js > optimist


1 comment:

  1. Hello! I just wanted to ask if you ever have any problems with hackers? My last blog (wordpress) was hacked and I ended up losing a few months of hard work due to no back up. Do you have any methods to stop hackers?

    ReplyDelete