Skip to content

Instantly share code, notes, and snippets.

@dobrych
Created May 10, 2011 17:59
Show Gist options
  • Save dobrych/964998 to your computer and use it in GitHub Desktop.
Save dobrych/964998 to your computer and use it in GitHub Desktop.
parse virtual hosts info from multiple apache configs
#!/bin/sh
find /webhomes/*/conf -name vhost.conf | while read -r CONF
do
username=$(echo $CONF | awk 'BEGIN { FS = "/" } ; {print $3}')
domains=$(egrep 'ServerName|ServerAlias' $CONF | awk '{print $2}')
echo $username: $domains
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment