Gautam's Blog

The technical blog of Gautam!

Browsing Posts in scripting

awk ‘/string1/ && /string2/’ file

How to write a shell script

A server I had been monitoring had multiple installations of apache web server. The system had about 10-15 httpd.conf files. I needed to figure out the httpd.conf that was configured to start website a. Below is a shell script that I wrote at the command promt:

for i in `locate httpd.conf`; do grep -l a.com $i;done

Powered by WordPress Web Design by SRS Solutions © 2012 Gautam's Blog Design by SRS Solutions