I have a list containing a set of tags, and would like to exclude one tag, unless another tag exists in the line.

Say I have the following list, and want to exclude B, unless A is present.

[A,B]
[A,C]
[B,C]
[A]
[B]

I can reverse grep for B:

> grep --invert-match "B"
[A,C]
[A]

How can I find the previous list, but also the item containing [A,B]?

You are viewing a single thread.
View all comments View context
1 point

You don’t need parentheses here.

permalink
report
parent
reply
1 point

How dare you?

Thanks!

permalink
report
parent
reply

Community stats

  • 86

    Monthly active users

  • 74

    Posts

  • 173

    Comments