Hello,
script just reads on input user names, but mgmt_cli itself can give you what are you looking for, but you have to change select from one user "command show user" to multi user select:
https://sc1.checkpoint.com/documents/latest/APIs/index.html#cli/show-users~v1.8.1%20
As you can see, management cli is returning name, so you can easy ask for that:
[Expert@cp-mgmt:0]# mgmt_cli -r true show users --format json|jq '.objects[] |select((.name)|contains("vpn")).name'
user_vpn
user1_vpn
reading this specified email for output name of user can be done for example by:
mgmt_cli -r true show users details-level full --format json | jq -r '.objects[] | select(.name | contains ("vpn")) | .email'
user_vpn@test.com
user1_vpn@test.com
Both together:
mgmt_cli -r true show users details-level full --format json | jq -r '.objects[] | select(.name | contains ("vpn")) | [.email,.name]'
[
"user_vpn@test.com",
"user_vpn"
]
Hope this is what you are looking for.
Tomas