Hacker News new | ask | show | jobs
by indigodaddy 2965 days ago
Correction, this was done on CentOS 7.3.x (not CentOS 6 as I had incorrectly first noted), and the following versions of bash and grep:

"GNU bash, version 4.2.46(1)-release (x86_64-redhat-linux-gnu)"

"grep (GNU grep) 2.20"

So where $data is a newline delimited list of items/patterns:

  grep "${data}" 
..will indeed match each item/pattern individually and grep over each, eg, just as grep -f does against a file with a list of patterns. It doesn't work without the double quotes, and putting the echo in front was obvious derp in hindsight. See my comment where I replied to uraza and demonstrated this.