Lines containing and lines not containing

Dear All,
Apologies for the beginners question - how I can get lines of files containing A but not containing B?

For example - lines of file containing “link” but not containing “lowpri”.

Q: lines containing “eth” of file "/etc/llttab"
A: link eth3 eth-00:90:fa:bf:1b:88 - ether - -
A: link eth10 eth-00:90:FA:BF:19:41 - ether - -
A: link-lowpri bond0 bond0 - ether - -
T: 5054

Q: lines containing “link” of file "/etc/llttab"
A: link eth3 eth-00:90:fa:bf:1b:88 - ether - -
A: link eth10 eth-00:90:FA:BF:19:41 - ether - -
A: link-lowpri bond0 bond0 - ether - -
T: 270

Q:

Thank you,
Aleksandr

add a space to the comparison string, perhaps?

Q: lines containing "link " of file "/etc/llttab"

Thank you! This was very fast suggestion!

I was looking for something more generic - what if we want “eth” bit not “bond”?

Thank you,
Aleksandr

Hello Aleksandr,

Please try the following relevance:

q: lines whose ((it contains "eth") and (it does not contain "bond")) of file "/etc/llttab"

Regards,
Vitaliy

Simple and beautiful :slight_smile: ! Thank you!

Q: lines whose ((it contains “eth”) and (it does not contain “bond”)) of file "/etc/llttab"
A: link eth3 eth-00:90:fa:bf:1b:88 - ether - -
A: link eth10 eth-00:90:FA:BF:19:41 - ether - -
T: 189

Q: