Guest User

Untitled

a guest
Aug 10th, 2018
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. abc="Create [newSystem=System [identityDomain=bbundlesystemser201201-test, admin=AdminUser [firstName=BSystemAdminGivenName, middleName=null, lastName=BSystemAdminFalilyName, userName=bbundlesystemadminusername, password=*******, email=hello@example.com], idmConsoleURL=https://abc.com.jspx, sftpHost=d910.abc.com, sftpUser=3pyylzoo, sftpPwd=*******]]"
  2. echo $abc
  3. sed -n 's/^userName= //p' "$abc"
  4.  
  5. userName=bbundlesystemadminusername
  6.  
  7. $ declare -A a
  8. $ while IFS== read k v; do a["$k"]="$v"; done < <(grep -oEi '[a-z]+=[^], ]+' <<<"$abc")
  9. $ printf '%qn' "${a[userName]}"
  10. bbundlesystemadminusername
  11.  
  12. [[ $abc =~ userName=([^][,[:space:]]+) ]] && userName="${BASH_REMATCH[1]}"
  13. echo "$userName"
  14.  
  15. bbundlesystemadminusername
  16.  
  17. userName=$(sed 's/.*userName=([^][,[:space:]]*).*/1/' <<< "$abc")
Add Comment
Please, Sign In to add comment