Skip to content

Instantly share code, notes, and snippets.

@allthingscode
Created January 28, 2011 21:46
Show Gist options
  • Save allthingscode/801050 to your computer and use it in GitHub Desktop.
Save allthingscode/801050 to your computer and use it in GitHub Desktop.
This script is an exact alias to egrep except that instead of printing out the files, it opens them in VIM sequentially.
#!/bin/bash
#
shopt -s -o nounset # Option Explicit
# =============================================================================
for ITEM in `egrep -l $* 2> /dev/null | sed -e 's/ /[SPACE]/g'` ; do
# unescape spaces
declare FILEPATH
FILEPATH=`echo $ITEM | sed -e 's/\[SPACE\]/ /g' -e 's/\n//g'`
vim $FILEPATH
done
exit 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment