Skip to content

Instantly share code, notes, and snippets.

@pad92
Created July 26, 2012 14:44
Show Gist options
  • Save pad92/3182457 to your computer and use it in GitHub Desktop.
Save pad92/3182457 to your computer and use it in GitHub Desktop.
Expand apache Vhost
#!/usr/bin/env sh
if [ ! -f "$1" ]; then
echo "Usage $0 : filename to paste"
exit 1
fi
COUNTER=0
while read LINE
do
echo -ne "$LINE" | grep -E "^<VirtualHost" 1>/dev/null
if [ $? -eq 0 ]; then
let COUNTER++
echo "$LINE into /tmp/$COUNTER.conf"
echo -n > /tmp/$COUNTER.conf
fi
echo $LINE >> /tmp/$COUNTER.conf
done < $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment