help with perl

walo

Verified User
Joined
Mar 19, 2005
Messages
162
i need to make a line script than can remove a specific line from the httpd.conf file

I get this, but it doesn't work
Code:
perl -ni -e 'unless (m//usr/local/directadmin/data/users/myuser/httpd.conf$/) { print }' /etc/httpd/conf/httpd.conf 2>&1
Which i need to remove is a line like this one:
Code:
Include /usr/local/directadmin/data/users/myuser/httpd.conf
 
i need to make a line script than can remove a specific line from the httpd.conf file

I get this, but it doesn't work
Code:
perl -ni -e 'unless (m//usr/local/directadmin/data/users/myuser/httpd.conf$/) { print }' /etc/httpd/conf/httpd.conf 2>&1
Which i need to remove is a line like this one:
Code:
Include /usr/local/directadmin/data/users/myuser/httpd.conf
Hello,

If you want to remove that quoted Include statement, you could do something like this with Perl:
Code:
perl -pi -e 's!Include\s/usr/local/directadmin/data/users/[^/]+/httpd.conf!!g' /usr/local/directadmin/data/users/*/httpd.conf
Note that won't get rid of the trailing line break, and if you don't want to remove the line for ever user, make sure to replace the * with a username.

Good luck.
 
Back
Top