Tips on useful commands when you want to exclude lines that start with comments
Good evening, I'm Sato, a man whose workload is proportional to the amount of clutter on his desktop.
I often have to read and investigate various configuration files and codes during my work, and I often find myself reading and investigating various configuration files and codes.
The comments are annoying!
Have you ever thought that (especially when doing research)?
In such a case, use this alias to feel refreshed!
alias ggrep='grep -v -e "^\s*#" -e "^\s*$"'
- From the beginning of the line #
- followed by a space from the beginning of the line #
- Line breaks only
Lines with 3 patterns are excluded.
Comments other than # are not supported, so please rewrite as appropriate to match the characters of the comment you want to exclude.
By the way
While writing this article,
I
that stands
for Globally R egular Expression Print
The alias name is ggrep for the simple reason that we already have commands egrep and fgrep, so it's the next best choice.
If you like it, please add it to the bottom of your .bashrc.