Created
May 23, 2012 04:52
-
-
Save ivanacostarubio/2773339 to your computer and use it in GitHub Desktop.
Pretty Grep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh | |
# this script greps .rb files on the the current directory recursively for a word displaying the line, line number and file path. | |
# greps recursively ruby files and displaing lines | |
grep -r -n --include="*.rb" $1 . | | |
# strip white spaces | |
tr -d ' '| | |
# use columns | |
column -s : -t | | |
# We use awk to re arrange the colums and color them | |
awk '{ print "\033[1;31m" $2 " " "\033[1;32m" $1 " " "\033[1;34m" $3}' | | |
# and we output a bit better the columns | |
column -t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
echo $TERM
-> screen-256color
ubuntu 11.10