RSS Subscription
Linux Howtos & Tutorials

Enter your email:

Delivered by


NOTE:New tutorials are from LinuxCareer.com

Poll

Do you own or wish to have iPhone?
 


Linux eBooks FREE Download
A guide to programming Linux kernel modules
Introduction to Linux - A Hands on Guide
A Newbie's Getting Started Guide to Linux

Linux from Scratch - Create Your Own Linux System - Free eBook

Linux: The Hacking Solution (v.3.0)

SQLite 3 with PHP Essential Training – Free Video Training Tutorials

This guide will introduce you to the world of GNU/Linux

The GNU/Linux Advanced Administration

A Complete Beginner's Manual for Ubuntu 10.04 (Lucid Lynx)

Advanced Bash-Scripting Guide

Set up, maintain, and secure a small office email server

Partner Linux Sites:
How-To.LinuxCareer.com
Jobs.LinuxCareer.com
TuxMachines
Monsterb
LinuxBloggers
AdamsInfo
LinuxScrew
All For Linux

Remove or ignore all comment lines from Linux config files

Suppose that you would like to read a config file without comments. For example we have config.conf file as follows:

# my config.conf file example

# set conf variable to 0

conf = #0;

# end config.conf file

Following grep command assumes that each comment starts with single # character at the beginning of the line. To remove or ignore all comments from a file a following grep command can be used:

$ grep -v ^\# config.conf | grep  .
conf = 0;

NOTE:"grep ." also removes all empty lines from a file.

One reason to ignore all comment lines is to see relevant config settings of any particular conf file. As an example /etc/hdparm.conf contains 137 lines.

$ cat /etc/hdparm.conf | wc -l
137

when removing comment lines we get:

$ grep -v ^\# /etc/hdparm.conf | grep  .
quiet

Share this linux post:

Submit Remove or ignore all comment lines from Linux config files in Delicious Submit Remove or ignore all comment lines from Linux config files in Digg Submit Remove or ignore all comment lines from Linux config files in FaceBook Submit Remove or ignore all comment lines from Linux config files in Google Bookmarks Submit Remove or ignore all comment lines from Linux config files in Stumbleupon Submit Remove or ignore all comment lines from Linux config files in Technorati Submit Remove or ignore all comment lines from Linux config files in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.


Linux eBooks FREE Download