Guest User

Untitled

a guest
Jan 22nd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # grep "Membership.*jira-users" entities.xml
  4. # -- extract the lines of XML defining members of jira-users. for JIRA 4.4, these lines look like:
  5. # <Membership id="10002" parentId="10002" childId="10000" membershipType="GROUP_USER" parentName="jira-users" lowerParentName="jira-users" childName="Greg.Boyington" lowerChildName="greg.boyington" directoryId="1"/>
  6. #
  7. # cut -d' ' -f12
  8. # -- extract just the childName attribute eg. childName="Greg.Boyington"
  9. #
  10. # awk '{FS="\""; print $2}'
  11. # -- extract the usernames only eg. Greg.Boyington
  12. #
  13. # sort -fr
  14. # -- sort the Mixed.Case and lower.case usernames alphabetically, Mixed.Case first
  15. #
  16. # uniq -i
  17. # -- select only the Mixed.Case usernames
  18. #
  19. # sed -i "s/$u/\L$u/g" entities.xml
  20. # -- replace all occurrences of $u, the Mixed.Case username, with the lowercase equivalent
  21.  
  22. cp entities.xml entities.xml.orig
  23. for u in `grep "Membership.*jira-users" entities.xml.orig| cut -d' ' -f12|awk '{FS="\""; print $2}'|sort -fr|uniq -i`; do sed -i "s/$u/\L$u/g" entities.xml; done
Add Comment
Please, Sign In to add comment