ack '(?=silver).*needle' haystack
is really not the same as: grep needle haystack|grep silver
Because with the double grep method, a match will be made whether "silver" is before or after "needle"; while with the single ack command shown above, a match will only be made when "silver" comes before "needle".Also, I'm not sure why the author uses
ack '(?=silver).*needle' haystack
instead of simply: ack 'silver.*needle' haystack