Hi everyone
i want to write a script to grep multiple pattern from all the file from a dir.
for example I want to get all the record number from XML file who's last name is asd, smith, dfrt,gokul,and sinha.
I tried
egrep('sinha'|'gokul'|'asd')
but it is not working
also i tried saving all the pattern to a file and then
grep-f pattern_file ads/dsds/dsds/dsd/actualfile
I might be doing something wrong but not able to figure it out.
Thanks
$
$
$ cat f6
line_1 : asd
line_2 : sinha
line_3 : blah
line_4 : gokul
line_5 : cat
line_6 : dog
$
$ egrep "asd|gokul|sinha" f6
line_1 : asd
line_2 : sinha
line_4 : gokul
$
$ # or
$
$ grep -E "asd|gokul|sinha" f6
line_1 : asd
line_2 : sinha
line_4 : gokul
$
$
$
$ echo "asd|gokul|sinha" >pattern_file
$
$ cat pattern_file
asd|gokul|sinha
$
$ cat f6
line_1 : asd
line_2 : sinha
line_3 : blah
line_4 : gokul
line_5 : cat
line_6 : dog
$
$
$ grep -E -f pattern_file f6
line_1 : asd
line_2 : sinha
line_4 : gokul
$
$ # or
$
$ egrep -f pattern_file f6
line_1 : asd
line_2 : sinha
line_4 : gokul
$
$
tyler_durden
Thanks a lot tyler Durden