Hi All,
I need to find all files in a directory which are containing specific pattern. Thing is that file name should not consider if pattern is only in commented area.
all contents which are under /* */ are commented
all lines which are starting with -- or if -- is a part of some sentence then all words after -- are commented in that line
for eg. I need to find all files which are containing insurance_no
file1-- this file should qualify for our search
file2-- this file should not be qualified for our search as insurance_no is in commented area only
the commands that i have tried so far is below but it not working as it considers those files also (in this case file2 also)which are containing only commented inurance_no also
Thanks in advance for all your guidance /help.
I need to find all files in a directory which are containing specific pattern. Thing is that file name should not consider if pattern is only in commented area.
all contents which are under /* */ are commented
all lines which are starting with -- or if -- is a part of some sentence then all words after -- are commented in that line
for eg. I need to find all files which are containing insurance_no
file1-- this file should qualify for our search
Code:
where insurance_no=TGT.insurance_no
-- insurance_no is unique no.
select * from
table t1,t2
where t1.name=t2.name
and t.asset>2000 --and insurance_no <> "2521"
/* based on insuranace_no cutomer full
details can be find out*/
Code:
-- insurance_no is unique no.
select * from
table t1,t2
where t1.name=t2.name
and t.asset>2000 --and insurance_no <> "2521"
/* based on insuranace_no cutomer full
details can be find out*/
Code:
find . -name "*.*" -exec grep -l "insurance_no" {} \; 2>/dev/null
find . -name "*.*" |xargs -n1 -I {} sh -c 'grep insurance_no {}|grep -v ".*--.*insurance_no.*"|grep -v ".*/\*.*insurance_no.*\*/" '