在命令行中运行awk程序时出错:“ ^反斜杠不是行中的最后一个字符”

时间:2019-11-29 17:10:16

标签: awk visual-studio-code

遵循手动方法 https://www.gnu.org/software/gawk/manual/gawk.html

我正在使用awk扩展名在Visual Studio代码中编写第一个示例:

awk 'BEGIN { print "Don\47t Panic!" }'

和控制台正在向我返回此错误:

  

^反斜杠不是行中的最后一个字符

可能是什么问题?

1 个答案:

答案 0 :(得分:0)

我认为您的awk版本可能是一个错误,还是某种方式vscode可以解析\47?对我来说...直接从Linux命令行没有问题。

$ awk -V
GNU Awk 4.2.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.1.2)
Copyright (C) 1989, 1991-2018 Free Software Foundation.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.

$ awk 'BEGIN { print "Don\47t Panic!" }'
Don't Panic!