Useful command tips for excluding lines that start with comments

Good evening, I'm Sato, a man whose desktop clutter is proportional to the amount of work he has to do

I often read and investigate various configuration files and codes in my work

The comments are annoying!

Have you ever thought this (especially while researching)?

In such cases, use this alias to make things easier!

alias ggrep='grep -v -e "^\s*#" -e "^\s*$"'

  • From the beginning of the line#
  • If there are spaces at the beginning of the line,
  • Line break only

Lines with the following three patterns will be excluded

Comments other than # are not supported, so please rewrite it appropriately to match the characters of the comment you want to exclude

By the way

While writing this article,
I

learned for the first time that
grep stands for Globally Regular Expression Print

The alias is named ggrep simply because there are already commands called egrep and fgrep, so it comes next

If you like it, please add it to the end of your .bashrc

If you found this article useful, please click [Like]!
0
Loading...
0 votes, average: 0.00 / 10
951
X Facebook Hatena Bookmark pocket

The person who wrote this article

About the author

Seiken Sato

My sixth sense is sharp when I'm in a pinch, but I'm basically an old-fashioned engineer.I'm
currently working in the Canadian office.