Changes

Jump to: navigation, search

stoney core: OpenLDAP ldapseach and replace

342 bytes added, 13:13, 14 December 2020
/* Search an replace - Replace a section (part) of an attribute - Step by step */
Finally, we need to loop over all the distinguished names and replace the original (old) content to the attribute with the new content:
<source lang='bash'>
dn="" # Reset the dn to an empty string
while IFS= read -r line; do
# Check, if the line starts with the ldap attribute of which we want to replace a part of the content if [[ "$line" =~ ^dn${ldap_attribute}.* ]]; then echo "# Before: $line" line=${line//stepping stone GmbH/stepping stone AG} # Replace all matches of pattern with string. website=${website////\\/} echo "# After: $line"
fi
done <<< "$result"
3,368
edits