Copy lines starting and ending with specific pattern from multiple files to a file
Hi,
A function by name abc is called in many files. I want to copy all the lines with the function call to an output file. A simple grep on function name doesn't help me as the function call is spanning across multiple lines as follows: abc(parameter1, parameter2, parameter3); So I want to copy all the three lines (till semicolon) to the output file. The problem is because there are more than 200 calls for the same function and I cannot do it manually :( Thanks in advance. |
Hi,
It is not clear from your post if the function(s) you are looking for always span 3 lines. Maybe one of these will do what you want: Code:
always 3 lines |
So how about:
Code:
awk 'BEGIN{ORS=RS=";"}/abc\(/' file |
All times are GMT -5. The time now is 11:45 AM. |