Linux command grep
【Purpose】
Learning how to use grep commad, we will introduce three methods.
【Eevironment】
Ubuntu 16.04 terminal
【Procdeure】
example1:
# check for whitespace in $SRC and exit for safety reasons
grep -q "[[:space:]]" <<<"${SRC}" && { echo ""${SRC}" contains whitespace. Not supported. Aborting." >&2 ; exit 1 ; }
example:2
# find specific string $String
grep $String ./ -r -n
example:3
# loopup does not start with # and space line
grep -v ^# ./conf/hbase-env.sh | grep -v ^$