Overview
The purpose of this document is guide display the contents
of the file without blank lines and un-commented lines of a file on Linux Operating
flavours.
Applies To
Tested on RHEL 7, CentOS 7.
Pre-Requisites
·
None
Print Non-Blank Lines
In order to display the contents of the file without
blank lines run the command below;
cat /etc/sudoers | grep -v '^$' | head
Note: Commented lines will be printed.
Print Un-commented Lines
In order to display the contents of the file suppressing
commented lines run the command below;
cat /etc/sudoers | grep -v '^ *#'
Note: Blank lines will be printed.
Print Non-Blank and Un-commented
Lines
In order to display the
contents of the file without blank and suppressing commented lines only run the
command below;
cat /etc/sudoers | grep -E -v '^$|^ *#'
No comments:
Post a Comment