By mnassiri
I have the following output and Ineed to get the variable that is assigned to CN in each line. I have access to SED utility. Can anyone help please?
Regards
“CN=BIS Helpdesk Mailbox_SendAs,OU=ExchangeShareMailboxesACL,OU=Groups,DC=ad,DC=btmna,DC=com”
“CN=BIS Helpdesk Mailbox_FullAccess,OU=ExchangeShareMailboxesACL,OU=Groups,DC=ad,DC=btmna,DC=com”
“CN=CPM Mailbox_SendAs,OU=ExchangeShareMailboxesACL,OU=Groups,DC=ad,DC=btmna,DC=com”
“CN=CPM Mailbox_FullAccess,OU=ExchangeShareMailboxesACL,OU=Groups,DC=ad,DC=btmna,DC=com”
“CN=SF Mailbox_SendAs,OU=ExchangeShareMailboxesACL,OU=Groups,DC=ad,DC=btmna,DC=com”
“CN=SF Mailbox_FullAccess,OU=ExchangeShareMailboxesACL,OU=Groups,DC=ad,DC=btmna,DC=com”
I need to get the name of the mail box indicated after the CN
For example: I need to ge this out put from line one
BIS Helpdesk Mailbox_SendAs
So anything after the CN= until the ,
The line starts with CN= and the text I’m interest in is between CN= and
the next occfurance of the , Comma
I’m using SED command with these options
Usage: sed [OPTION]… {script-only-if-no-other-script} [input-file]…
-n, –quiet, –silent
suppress automatic printing of pattern space
-e script, –expression=script
add the script to the commands to be executed
-f script-file, –file=script-file
add the contents of script-file to the commands to be ex
-i[suffix], –in-place[=suffix]
edit files in place (makes backup if extension supplied)
-l N, –line-length=N
specify the desired line-wrap length for the `l’ command
-r, –regexp-extended
use extended regular expressions in the script.
-s, –separate
consider files as separate rather than as a single conti
long stream.
–text switch to text mode
-u, –unbuffered
load minimal amounts of data from the input files and fl
the output buffers more often
–help display this help and exit
-V, –version output version information and exit
If no -e, –expression, -f, or –file option is given, …read more