I am new to awk command and I had a question in using it.
I want to filter a code file and print specific functions (that contain menu word in the function name).
for example, if the file has:
function menu1()
{
}
function f2()
{
}
function menu3()
{
}
so I want the command to print the first and third functions only.
I wrote the below command using range patterns:
awk '
/.*function.*menu\(\)/,/^ *\} *$/
'
but there is a problem, the above one prints the function until the first "}" even if it is not the ending of the function , is there a way to fix this??
function $reset_report(), invisible
{
a = set_value;
return @true;
}
function $reset_palette_menu(),INDIRECT
{
if ( v == "")
$notify(message1, @warning);
else {
$replace_palette();
}
b = value;
}
and I need the output to be:
function $reset_palette_menu(),INDIRECT
{
if ( v == "")
$notify(message1, @warning);
else {
$replace_palette();
}
b = value;
}
but the command I wrote above only prints the function until the first "}":
function $reset_palette_menu(),INDIRECT
{
if ( v == "")
$notify(message1, @warning);
else {
$replace_palette();
}