In the below string, please let me know how to make the sed search case-incensitive. I have more such lines in my script instead of [Aa] let me know any other easier option.
sed -n '/dn: MSISDN=/,/^\s*$/p' full.ldif > temp ; sed -n '/,dc=msisdn,ou=identities,'"$LDAP_ROOT_DN"'/,/^\s*$/p' temp > alias_MSISDN_PL.ldif ; rm temp
I can't offer you a (single) command but a procedure how to do it - even with a standards-conforming (non-GNU) sed :
First, save your pattern space to the hold space.
Next, you use the y/.../.../ -command to transliterate to lower
Finally you do your matching and get from the hold space the saved copy of the pattern space on which you perform whatever action you wanted to perform.
Here is an (very simple) example: we search (case-insensitively) for "hello" at the beginning of the line and add a equal-sign in front of it. The comments are NOT part of the script:
echo 'Hello
foo
hElLo
helLO' |\
sed 'h # pattern to hold space
y/HELO/helo/ # we need only to convert what we match
/^hello/ {
g # get the original line from hold space
s/^/=/
b end
}
/^hello/ ! {
g
}
:end'