I have a column based .txt file and I want to grep output the Common Name, having a little trouble.
V 300223164711Z 01 unknown /C=UK/O=LMG/OU=server/CN=server/name=server/emailAddress=support@kam.org
V 300223170002Z 02 unknown /C=UK/O=LMF/OU=server/CN=test/name=server/emailAddress=support@kam.org
V 300223170935Z 03 unknown /C=UK/O=risk/OU=server/CN=risk/name=server/emailAddress=support@kam.org
My current grep output does the following:
tail -n +2 index.txt | grep "^V" | cut -d '/' -f 5 | nl -s ') '
1) CN=test
2) CN=risk
I only want the name to be the output, 'test' or 'risk'. What would be the simplest way to achieve this?