I can grep two strings 'ion' and 'spin' from a file but would also like to either:
- grep only if both strings exist
- or only grep if the 2nd string is in the next line
grep -w 'ion\|spin' filename
I want to grep from a file which contains random strings like this:
<set comment="ion 3">
<set comment="spin 1">
but only if the word "spin" occurs in the next line.