Hi All,
I have almost 1000+ files and I want to search specific pattern. Looking forwarded your input. Pls note that need to ignore words in between /* */
Search for: "insert into xyz" (Which procedure contain all 3).
Expected output:
procedure test1
function test2
procedure test3
procedure test1
function test2
procedure test3
File Contain:
procedure test1
insert into xyz;
end;
FUNCTION
test2
insert
into
xyz
end;
procedure test3
insert /* asas*/
into xyz
end;
procedure test4
inserting into xyz
end;
$ cat f1
procedure test1
insert into xyz;
end;
FUNCTION
test2
insert
into
xyz
end;
procedure test3
insert /* asas*/ into
xyz
end;
procedure test4
inserting into xyz
end;
$ awk ' BEGIN { RS=";" }
{
gsub("/\\*.*\\*/","");
if(match($0,".*insert[ \t\n]*into[ \t\n]*xyz.*")>0)
print $1,$2
}' f1
procedure test1
FUNCTION test2
procedure test3
$