I need to check a lot of configuration files and like to cat
them without the lines beginning with comments.
I am typing the following in the shell:
egrep -v '^[[:blank:]]*#' *filename* | awk 'NF'
which works:
$ egrep -v '^[[:blank:]]*#' /etc/nginx/nginx.conf | awk 'NF'
user nginx nginx;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
}
http {
sendfile on;
}
instead of typing it each time, I wish to make an alias on my batch, but I can't find a way to do so (neither to find info on the net for that :( ).
I tried :
testfunc () { egrep -v '^[[:blank:]]*#' $0 | awk 'NF'; }
but it doesn't work :-(
$ testfunc /etc/nginx/nginx.conf
nothing is returned :( What do I miss ??