Hello I have a datafile like this:
<Key name="com.ahsay.afc.cpf.UserGroup" content="" allowMultiple="Y"> <Value name="rsv-id" inheritParentAttribute="Y" type="string" data="1328200856753" /> <Value name="rsv-group-name" inheritParentAttribute="Y" type="string" data="group 1" /> <Value name="rsv-user-type" inheritParentAttribute="Y" type="string" data="backup-user" /> <Value name="rsv-owner" inheritParentAttribute="Y" type="string" data="" /> <Key name="com.ahsay.afc.cpf.User" content="" allowMultiple="Y"> <Value name="rsv-id" inheritParentAttribute="Y" type="string" data="13279083887401" /> <Value name="rsv-login-name" inheritParentAttribute="Y" type="string" data="name1" /> </Key> <Key name="com.ahsay.afc.cpf.User" content="" allowMultiple="Y"> <Value name="rsv-id" inheritParentAttribute="Y" type="string" data="13279083887401" /> <Value name="rsv-login-name" inheritParentAttribute="Y" type="string" data="name2" /> </Key> </Key> <Key name="com.ahsay.afc.cpf.UserGroup" content="" allowMultiple="Y"> <Value name="rsv-id" inheritParentAttribute="Y" type="string" data="1328200856753" /> <Value name="rsv-group-name" inheritParentAttribute="Y" type="string" data="group 2" /> <Value name="rsv-user-type" inheritParentAttribute="Y" type="string" data="backup-user" /> <Value name="rsv-owner" inheritParentAttribute="Y" type="string" data="" /> <Key name="com.ahsay.afc.cpf.User" content="" allowMultiple="Y"> <Value name="rsv-id" inheritParentAttribute="Y" type="string" data="13279083887401" /> <Value name="rsv-login-name" inheritParentAttribute="Y" type="string" data="name3" /> </Key> <Key name="com.ahsay.afc.cpf.User" content="" allowMultiple="Y"> <Value name="rsv-id" inheritParentAttribute="Y" type="string" data="13279083887401" /> <Value name="rsv-login-name" inheritParentAttribute="Y" type="string" data="name4" /> </Key> </Key> So in script iI know the login name of the record I want, and iI need to match it to a group. Lets Let's say that iI want doto know what group name3name3 is (answerthe answer is group 3group 3)
. Currently iI can get the name orof the group out ifof the file with =:
perl -ne 'print "$_\n" foreach /name="rsv-group-name".\ data="([^"])"/g;'
perl -ne 'print "$_\n" foreach /name="rsv-group-name".*\ data="([^"]*)"/g;' but iI have no idea how doto match it with a user. How can I do that in a script?