gio001
1
Hello,
Why is this not returning files containing the string in the var $files?
files=`ls /dir1/dir_level2/dir_level3 | egrep "catch \["`
files=`ls /dir1/dir_level2/dir_level3` this by itself returns a list of files which I thought could be sent through grep or egrep to look for matches.
Can you help me understand?
Thanks.
vbe
2
Does ls /dir1/dir_level2/dir_level3 | egrep "catch \[" return something?
gio001
3
It does not return anything, and I know there are matches for this search .....
Thanks.
The syntax is:
egrep "catch \[" /dir1/dir_level2/dir_level3/*
Regards
gio001
5
Shouldn't these be equivalent? Yet they are not.
Can anyone explain? thanks.
files=`ls /dir1/dir_level2/dir_level3 | egrep "catch \["`
or even
files=`ls /dir1/dir_level2/dir_level3/* | egrep "catch \["`
files=`egrep "catch \[" /dir1/dir_level2/dir_level3/*`
No, they are not. These commands search for a pattern in the filenames:
files=`ls /dir1/dir_level2/dir_level3 | egrep "catch \["`
files=`ls /dir1/dir_level2/dir_level3/* | egrep "catch \["`
While this command search for a pattern in the files:
files=`egrep "catch \[" /dir1/dir_level2/dir_level3/*`
Regards