[Osaka/Yokohama/Tokushima] Looking for infrastructure/server side engineers!

[Osaka/Yokohama/Tokushima] Looking for infrastructure/server side engineers!

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Successor to CentOS] AlmaLinux OS server construction/migration service

[Successor to CentOS] AlmaLinux OS server construction/migration service

[For WordPress only] Cloud server “Web Speed”

[For WordPress only] Cloud server “Web Speed”

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.

If you found this article helpful , please give it a like!
0
Loading...
0 votes, average: 0.00 / 10
715
X facebook Hatena Bookmark pocket
[2026.6.30 Amazon Linux 2 end of support] Amazon Linux server migration solution

[2026.6.30 Amazon Linux 2 end of support] Amazon Linux server migration solution

The person who wrote this article

About the author

Seiken Sato

I have a good sixth sense when I'm in a pinch, but I'm basically an old-school engineer.Currently, I
work in the Canadian office.