Hi,
i have a directory structure which contains few files each.
each file in turn has some functions. i'm searching for a word, say 'pen' in all the files present in all the directories. :wall:
consider a file file1.c in Dir1. out of the 3 funcs present in this file, func1(pennum) and func3('pen++' in the commented part) has 'pen' word in them.
-----------
Dir1
file1.c
-----------
int func1(int var1,char var2)
{
int pennum = 0;
while(pennum<10)
{
pennum++;
}
}
char func2(int var1,char var2)
{
int hen = 0;
while(hen<10)
{
hen++;
}
}
other func3(int var1,char var2)
{
int den = 0;
while(den<10)
{
/* should this be pen++ :P*/
den++;
}
}
similarly a file file2.c in Dir2. out of the 2 funcs present in this file, func19('pen' in the commented part) has 'pen' word in them.:rolleyes:
-----------
Dir2
file2.c
----------
char func2(int var1,char var2)
{
int hen = 0;
while(hen<10)
{
hen++;
}
}
other func19(int var1,char var2)
{
int den = 0;
while(den<10)
{
/* should this be pen :P*/
den++;
}
}
there is another file file3.c with no 'pen' word in the only function present in it.:wall:
-----------
Dir2
file3.c
----------
char func2(int var1,char var2)
{
int hen = 0;
while(hen<10)
{
hen++;
}
}
Now i need all the function names which have pen in them.
I would appreciate:) your help with the shell script to get the output in this format.
---------------------------------------------------------------------------------------------------------------
FileName FunctionName pattern
---------------------------------------------------------------------------------------------------------------
file1 func1 pennum
file1 func3 pen++
file2 func19 pen
Thanks,
Srini:b: