in unix you can just use "grep -v '^ *#' filename > filename.new"

the equivalent perl code would look like this 

#!/usr/bin/perl
while (<>) {                  # read lines from stdin or files named on
                              # the command line
    print unless (/^\s*#/);  # print $_ (which <> sets by default
                             # unless $_ starts with zero or more
                             # whitespace characters followed by a #
                             # If you only want to eliminate lines
                             # with # as the first character you can
                             # use /^#/
}

On 02 Jun 2001 18:14:56 +1000, chris robinson wrote:
> I need to write a regular expression to eliminate any lines in a text =
> file that start with a #.  how would I do this.
> 
> Many Thanks
> 

-- 
Today is Pungenday, the 7th day of Confusion in the YOLD 3167
Hail Eris, Hack Linux!


Reply via email to