How to solve this syntax error of gawk (GNU awk) on OSX terminal?
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
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/ BEGINRS="DEBUG"; FS="n"print $0"n"END' ./app_108_utf8_T2.log > output.txt
but awk says
gawk: cmd. line:1: /123/ BEGINRS="DEBUG"; FS="n"print $0"n"END
gawk: cmd. line:1: ^ syntax error
Why does awk say error?
linux command-line osx
add a comment |Â
up vote
0
down vote
favorite
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/ BEGINRS="DEBUG"; FS="n"print $0"n"END' ./app_108_utf8_T2.log > output.txt
but awk says
gawk: cmd. line:1: /123/ BEGINRS="DEBUG"; FS="n"print $0"n"END
gawk: cmd. line:1: ^ syntax error
Why does awk say error?
linux command-line osx
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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/ BEGINRS="DEBUG"; FS="n"print $0"n"END' ./app_108_utf8_T2.log > output.txt
but awk says
gawk: cmd. line:1: /123/ BEGINRS="DEBUG"; FS="n"print $0"n"END
gawk: cmd. line:1: ^ syntax error
Why does awk say error?
linux command-line osx
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/ BEGINRS="DEBUG"; FS="n"print $0"n"END' ./app_108_utf8_T2.log > output.txt
but awk says
gawk: cmd. line:1: /123/ BEGINRS="DEBUG"; FS="n"print $0"n"END
gawk: cmd. line:1: ^ syntax error
Why does awk say error?
linux command-line osx
asked Apr 11 at 8:36
user74176
1125
1125
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
3
down vote
accepted
IâÂÂm guessing you want to run
gawk 'BEGINRS="DEBUG"; FS="n" /123/print $0"n"' ./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.
Tangentially related: You also can't use e.g.condition && END ...
, which is a pity sometimes.
â Kusalananda
Apr 11 at 8:40
@user74176 If this solves your issue, please consider accepting the answer.
â Kusalananda
Apr 11 at 8:42
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
IâÂÂm guessing you want to run
gawk 'BEGINRS="DEBUG"; FS="n" /123/print $0"n"' ./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.
Tangentially related: You also can't use e.g.condition && END ...
, which is a pity sometimes.
â Kusalananda
Apr 11 at 8:40
@user74176 If this solves your issue, please consider accepting the answer.
â Kusalananda
Apr 11 at 8:42
add a comment |Â
up vote
3
down vote
accepted
IâÂÂm guessing you want to run
gawk 'BEGINRS="DEBUG"; FS="n" /123/print $0"n"' ./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.
Tangentially related: You also can't use e.g.condition && END ...
, which is a pity sometimes.
â Kusalananda
Apr 11 at 8:40
@user74176 If this solves your issue, please consider accepting the answer.
â Kusalananda
Apr 11 at 8:42
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
IâÂÂm guessing you want to run
gawk 'BEGINRS="DEBUG"; FS="n" /123/print $0"n"' ./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.
IâÂÂm guessing you want to run
gawk 'BEGINRS="DEBUG"; FS="n" /123/print $0"n"' ./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.
answered Apr 11 at 8:38
Stephen Kitt
140k22305365
140k22305365
Tangentially related: You also can't use e.g.condition && END ...
, which is a pity sometimes.
â Kusalananda
Apr 11 at 8:40
@user74176 If this solves your issue, please consider accepting the answer.
â Kusalananda
Apr 11 at 8:42
add a comment |Â
Tangentially related: You also can't use e.g.condition && END ...
, which is a pity sometimes.
â Kusalananda
Apr 11 at 8:40
@user74176 If this solves your issue, please consider accepting the answer.
â Kusalananda
Apr 11 at 8:42
Tangentially related: You also can't use e.g.
condition && END ...
, which is a pity sometimes.â Kusalananda
Apr 11 at 8:40
Tangentially related: You also can't use e.g.
condition && END ...
, which is a pity sometimes.â Kusalananda
Apr 11 at 8:40
@user74176 If this solves your issue, please consider accepting the answer.
â Kusalananda
Apr 11 at 8:42
@user74176 If this solves your issue, please consider accepting the answer.
â Kusalananda
Apr 11 at 8:42
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f436950%2fhow-to-solve-this-syntax-error-of-gawk-gnu-awk-on-osx-terminal%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password