Filtering (comment) lines with # in column one using a Bash script

From: Phisherman (nobody_at_noone.com)
Date: 03/28/04


Date: Sun, 28 Mar 2004 20:24:21 GMT

Is there an easy way to view all the lines of a file, except the lines
that begin with a pound sign (#)? I thought about using the commands
"less," "grep," and a pipe but I'm not sure about the proper
expression needed in grep.

What I want to do is view the contents of the file squid.conf without
all the comments. I know I could write a C program to do this, but
I'd rather use the Bash shell script.

Thanks



Relevant Pages

  • Re: findstr doesnt always find
    ... cygwin's grep gave the proper results once I ensured that all 0x0d == ... CR were stripped from the relevant files -- as a bonus said grep ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: Grep not finding using $var
    ... > Thanks for the replies. ... > The above grep that I mentioned is a part of a bash shell script. ... > The string is present in one of the text file in the $my_path ...
    (comp.unix.shell)