Rambling thoughts about D&D, Linux, and other things...Now featuring...College Stuff! Go Bruins!
Show contents of a file without commented out lines and blank lines
A customer asked me how to display the contents of a text file, in
this case a configuration file, without showing any blank line, nor
any lines that started with a "#" character (commented out lines).
We can do this at the Linux command line, using sed,
if you know how to craft the regex:
For further reference: https://www.gnu.org/software/sed/manual/sed.html
this case a configuration file, without showing any blank line, nor
any lines that started with a "#" character (commented out lines).
We can do this at the Linux command line, using sed,
if you know how to craft the regex:
sed -e '/^ *#/d' -e '/^$/d' /dir/file.conf
For further reference: https://www.gnu.org/software/sed/manual/sed.html
There are thousands of resources online: GOOGLE
Subscribe to:
Posts (Atom)