#!/bin/sed -rf /^#\tldap/ { s/^#\tldap$/\tldap/ } /Auth-Type LDAP/ { N N s/^#?(\s*)Auth-Type LDAP \{\ #?(\s*)ldap\ #?(\s*)\}/\1Auth-Type LDAP \{\ \2ldap\ \3\}/ }