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.

Perl comes with a handy utility called s2p (sed to perl) that will help
you convert sed scripts to perl.  $txtlist does not work because qx runs
the sed program and returns the results to your perl program but you are
not doing anything with the results.

You can do it in perl something like this:

perl -i~ -pe's|^#||; s|([  /])\./|$1|g' file1 file2 file3 ... fileN


John
-- 
use Perl;
program
fulfillment

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

Reply via email to