Reputation: 1
I want to parse a string in bash shell scripting
'serverDN' :'/DC=ch/DC=cern/OU=computers/CN=myserverName', \
and result should be like this
/DC=ch/DC=cern/OU=computers/CN=myserverName
Any help???
Upvotes: 0
Views: 86
Reputation: 360105
Strip off the beginning and the end:
string=${string#*:\'}
string=${string%\'*}
Upvotes: 3
Reputation: 67221
echo "'serverDN' :'/DC=ch/DC=cern/OU=computers/CN=myserverName', \\" |
awk -F"'" '{print $4}'
/DC=ch/DC=cern/OU=computers/CN=myserverName
Upvotes: 3