Signing back into the Community for the first time? You'll need to reset your password to access your account. Find out more.
Forum Discussion
misterJJ
3 years agoNew Contributor
List items from set of vaults
Hi,
I feel like I must be overlooking something as this seems quite simple.
I'm using the command op vault list --group groupname --format=json | op vault get -
The command retrieves a list of vaults, but how do i go from this to getting a list of all the items in those vaults?
Hoping someone can help :)
1Password Version: 8.9.13
Extension Version: Not Provided
OS Version: Not Provided
Browser:_ Not Provided
- Nhat_Nguyen
1Password Team
Hello misterJJ,
To get a list of items from your vaults, we can give these steps a try.
We will leverage jq to help us retrieve vault IDs from JSON. jq is a command line tool used to process JSON. Please have a look here to learn more and to install
After that, we can then create a list of vaults a group has access to, then use jq to extract the vault ids and put them in a file.
op vault list --group <group name> --format json |\
op vault get - --format json |\
jq '.id' | sed 's/"//g' > list.txt
Finally, you can get items list from vault IDs in the file and remove the file.
cat list.txt | while read line; do
op item list --vault $line
done
rm list.txt
Best regards,
Nhat Nguyen.
https://support.1password.com/
- misterJJNew Contributor
Hi Nhat_Nguyen,
Thank you for the help. I was trying something similar through bash, but JQ will certainly make it easier.
I can't help wonder why the CLI tool doesn't support nested commands such as in this example.
It's basically just inserting the result from the op vault get - command into the op item list --vault command.
Do you know if there are any plans to enable this type of nesting in the commands?
Best regards,
Joachim