[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: sed, grep question



	My first suggestion would be RTFM(I normally hate this answer, but you really
should look at man pages as they are normally full of really good info).

	You can use grep.  The command would look like this:

grep -v "^#" filename > output-file

grep -v outputs all non-matching lines from filename into a file called
output-file.  The above grep outputs all lines not containing # as the first
character of the line.  The output is then redirected to a file.  You can then
rename the output-file to whatever you like.

Mark Thompson	

Calvin Lam wrote:
> 
> hi all,
> 
> I want to parse a configuration file which is full of comments to a output
> file which contain the real "stuff" (i.e. strip off all the comment).
> 
> For instance, my file is as follows:
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> # Comment with # at the very beginning
> 
> myvar=99            # comment at the end of the line
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> To parse it to a file like:
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> myvar=99
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> I think it can be done by sed and/or grep.  Please help.
> 
> Best Regards,
> 
> Calvin Lam
> 
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
> 
> --
> To unsubscribe: mail redhat-install-list-request redhat com with
> "unsubscribe" as the Subject.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]