|
|
|
|
|
by indigodaddy
2964 days ago
|
|
Right, and actually, it looks like only 'ls | grep "${data}"
' (eg, the data var double-quoted) works: [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
Believe that using echo in the backticks may amount to same effect as 'ls | `cat ..filelist.txt` (eg, results in ENOENT)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
|
|