grepp() { if test -z "$1" || test -z "$2" ; then echo "USAGE: grepp searchterm filetosearch"; else perl -00ne "print if /$1/i" < $2 fi }
之后即可使用grepp,如下
[crouse@veronica ~]$ grepp DAE /etc/rc.conf # # ------------------------------------------------------------------------------------------------- # DAEMONS # ------------------------------------------------------------------------------------------------- # # Daemons to start at boot-up (in this order) # - prefix a daemon with a ! to disable it # - prefix a daemon with a @ to start it up in the background # DAEMONS=(syslog-ng hal !dbus network netfs @openntpd @crond @sshd) [crouse@veronica ~]$