Artificial intelligent assistant

How to solve this syntax error of gawk (GNU awk) on OSX terminal? I'm using OSX terminal and trying to extract specified text of log file by regex. awk version is GNU Awk 4.2.1, API: 2.0 (GNU MPFR 4.0.1, GNU MP 6.1.2) Copyright (C) 1989, 1991-2018 Free Software Foundation. my trying operation is $gawk '/123/ BEGIN{RS="DEBUG"; FS="\n"}{print $0"\n"}END{}' ./app_108_utf8_T2.log > output.txt but awk says gawk: cmd. line:1: /123/ BEGIN{RS="DEBUG"; FS="\n"}{print $0"\n"}END{} gawk: cmd. line:1: ^ syntax error Why does awk say error?

I’m guessing you want to run


gawk 'BEGIN{RS="DEBUG"; FS="\
"} /123/{print $0"\
"}' ./app_108_utf8_T2.log > output.txt


`BEGIN` defines the block of instructions which run at the start of the process, and `/123/` defines the block which runs when the “123” regular expression matches the current line. You can’t specify both for a single block.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 968275dfb2baabe475569a3553f694fd