Hacker News new | ask | show | jobs
by alexfoo 5036 days ago
[ EDIT - Two replies as original post had been edited by the time I posted the first. ]

> and as a sidenote, something i only found recently, but which is quite useful, a logical AND with egrep looks like > > egrep 'Hardcover.Kindle'

That's not a true logical AND since it won't pick up an entry with the text "Kindle Hardcover". Only entries with the word "Hardcover" eventually followed by "Kindle". To cover both cases you'd need:-

  egrep 'Hardcover.*Kindle|Kindle.*Hardcover'
(Of course, someone will now show how this can be done in even fewer characters).
2 comments

How about:

    grep Hardcover | grep Kindle
Yup, but I had meant in one command though, i.e.

  sed -n '/Kindle/{/Hardcover/p}'
awk '/Kindle/ && /Hardcover/'

awk doesn't have to be complicated ;)