In article <[EMAIL PROTECTED]>, Raghu Murthy wrote:

> I need to remove ./ and #from a list of files. I can do it in sed but I am
> not able to use it in my perl script. I tried to do something like this
> 
> chomp ($txtlist = <STDIN>);
> qx' sed -e "/^#/d $txtlist'; # To remove lines starting with a #
> qx' sed -e"s?\([  /]\)\./?\1?g" $txtlist; # To remove lines starting with
> a ./
> 
> I can do it if i hard code the file name but if i try to use $txtlist it
> does not work. What am i doing wrong.

Can't you just do something like:

while (<DATA>) {
    s|^#+\s*||;  # remove leading #s and any spaces
    s|^\./||;    # remove leading "./"
    print;
}

To remove the entire line add "next if " in front of the regex.

-K


-- 
Kevin Pfeiffer


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to