Skip to main content
August 25, 2025
Question

op item list --tags a,b returns union not intersection

  • August 25, 2025
  • 2 replies
  • 27 views

How can I get the intersection of the two tags natively using op?

if not possible what s the easiest way to do it? any tips?

thanks

2 replies

August 25, 2025

Hi @jfs ,

'op' does not support it natively, but you can always use 'grep' twice for a quick filter. I guess it depends on what you are trying to do with the results.

op item list --tags a,b \
  | grep "a" \
  | grep "b"

Let me know if this is what you are after or something different.

Thanks,
Phil

jfsAuthor
September 3, 2025

Hello @1P_Phil
unfortunately your solution assumes that the tags are also embedded in the item's name and it s not the case. op item list returns the items that match those tags, but the tag is not displayed. If the tag is not part of the name, grep won t do anything.

could this be a possibly future feature?