From ee0d5924190b5485772291f2317a3dc3f2311e55 Mon Sep 17 00:00:00 2001 From: Vahagn Khachatryan Date: Tue, 21 Feb 2017 09:13:59 -0500 Subject: [PATCH] cgrep --- config/.bashrc | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/config/.bashrc b/config/.bashrc index 401792c..8106d64 100755 --- a/config/.bashrc +++ b/config/.bashrc @@ -259,7 +259,28 @@ else alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' fi -alias cgrep="grep --include \*.cpp --include \*.h --include \*.c" + +function cgrep() { + if [[ $# -eq 0 ]] + then + echo "Usage: codegrep " + else + grep -nR --colour \ + --include=\*.cpp \ + --include=\*.c \ + --include=\*.hpp \ + --include=\*.h \ + --include=\*.inc \ + --include=\*.php \ + --include=\*.py \ + --include=\*.sh \ + --exclude-dir=.git \ + --exclude-dir=.svn \ + --exclude-dir=llcalc* \ + --exclude-dir=00* \ + "$1" . + fi +} # Add an "alert" alias for long running commands. Use like so: