0

I have the following code:

int val

nameof_function();

above code is in this file filename.txt I try to find that sequence of lines in a file using

grep "int val.*\n.*(" filename.txt

but it is not working with multiple line.

I have also tried

awk '/int val/,/\(/' filename.txt 

Here i am not getting file name in output

If I am using grep I can find file name in output but not ble to search muliple line

I need an output that looks like this:

filename.txt:int val nameof_function

Please any one help me

vicky
  • 1

1 Answers1

0

if the source files contain the function separate by a line all you need to do is adjust the output of grep so it finds the int val and output the content 2 lines below also.

it would be something like this

grep -A 2 "int val" *.txt
BANJOSA
  • 721
  • Before ( symbol o need the value .. I can't go for two line .it will be bigger work .any other way for upto particularly take value with directors.@banjosa'a – vicky Jan 30 '20 at 15:26