From https://www.gnu.org/software/grep/manual/grep.html#Introduct...: "Since newline is also a separator for the list of patterns, there is no way to match newline characters in a text."
[jbrown@tools1 testdir1]$ data='testfile1 > testfile2 > testfile3 > testfile4 > testfile5 > testfile6 > testfile7 > testfile8 > testfile9 > testfile10' [jbrown@tools1 testdir1]$ echo $data testfile1 testfile2 testfile3 testfile4 testfile5 testfile6 testfile7 testfile8 testfile9 testfile10 [jbrown@tools1 testdir1]$ ls | grep `echo ${data}` <<NO OUTPUT>> [jbrown@tools1 testdir1]$ ls | grep ${data} <<NO OUTPUT>> [jbrown@tools1 testdir1]$ ls | grep "${data}" testfile1 testfile10 testfile2 testfile3 testfile4 testfile5 testfile6 testfile7 testfile8 testfile9
And of course, as many have mentioned grep -f does what I was looking for and would have prevented this whole exercise:
[jbrown@tools1 testdir1]$ ls | grep -f ../filelist.txt testfile1 testfile10 testfile2 testfile3 testfile4 testfile5 testfile6 testfile7 testfile8 testfile9
And of course, as many have mentioned grep -f does what I was looking for and would have prevented this whole exercise: