본문 바로가기
Research/SystemProg

cgrep

by sunnyan 2012. 1. 27.
728x90
#!/bin/bash

function usage()
{
   echo 'cgrep grep pattern from *.[chSs] or *.cpp or *.hpp or *.mk or [Mm]akefile'
}

if [ $# -eq 0 ]; then
    usage
    exit 1
fi
 
find . -type f -name "*.[chSs]" -o -name "*.cpp" -o -name "*.hpp" -o -name "*.mk" -o -name "[Mm]akefile" | xargs grep --color=auto -n "$1"

                                                                                                                                                          

728x90