Learn Perl and Regular Expressions :) It's in the "Programming Perl" book (aka the camel book).
Essentially, it would look like #!/usr/bin/perl ###READ THE FILE### open(THEFILE, "httpd.conf"); undef $/; #This makes the following read read in the whole file instead #of one line $httpdconf = <THEFILE>; close(THEFILE); ###DO THE SUBSTITUTION### $httpdconf =~ s!<VirtualHost\s+\*>\s+DocumentRoot\s+/var/www/virtual/$ARGV[1]/html.*?</virtualhost>!!; ###WRITE THE FILE### open(THEFILE, ">httpd.conf"); print THEFILE $httpdconf; close(THEFILE); ####END OF PROGRAM#### This should work, but I won't guarantee it. Jon On Thu, 20 Jun 2002, Jesse Angell wrote: > Hello, > I need to write a shell script to do the following > edit the /www/conf/httpd.conf file > and search for the > <VirtualHost *> > DocumentRoot /var/www/virtual/$user/html > Servername $user.palaceunlimited.com > ErrorLog /var/www/virtual/$user/logs/error_log > CustomLog /var/www/virtual/$user/logs/access_log combined > </VirtualHost> > and then delete all of that for the specified user varible.. > So it looks for the user specified.. then deletes all of the users virtual host >stuff including the start of the virtual host and the closing of it.. > Please help me out... > > > -------------- > Jesse Angell > PalaceUnlimited.com > #1 Palace Host > > > _______________________________________________ Redhat-list mailing list [EMAIL PROTECTED] https://listman.redhat.com/mailman/listinfo/redhat-list