这个 awk 脚本有什么作用?

发布于 2024-12-12 20:34:41 字数 423 浏览 3 评论 0原文

我有一个脚本需要进行逆向工程,但该脚本似乎已损坏。下面是脚本中中断的部分。

awk 'BEGIN{while ((getline line < "file1") > 0){F=../file2

类似的言论一一重复。明显的问题是有一个开始的 '{,但没有结束的。我可以尝试解决这个问题,但我真的不知道这到底想做什么。我对 Linux 命令有一些经验,但不是很多。

  1. 我知道 file2 是一个文件位置,但是 F= 是什么?
  2. 开头是',但是为什么呢?是否应该在某个地方有一个结束语,或者根本就不应该存在?

有人知道,或者有任何想法,这应该是什么?

I have a script that I need to reverse engineer, but the script appears to be broken. Below is a segment of the script around where it breaks.

awk 'BEGIN{while ((getline line < "file1") > 0){F=../file2

With similar statements repeated one after the other. The obvious problem is that there's an opening ' and {, but no closing ones. I could try to fix this, but I don't really know what this is even trying to do. I have some experience with linux commands but not a whole lot.

  1. I understand that file2 is a file location, but what is F=?
  2. There's the beginning ', but why? Should there be a closing one somewhere, or should that not even be there in the first place?

Anyone know, or have any ideas, as to what this is supposed to be?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不必在意 2024-12-19 20:34:41

据我所知,这条 awk 行有几个方面被破坏了。

  1. 它应该有一个终止 '' 包装您传递给 awk 命令运行的命令/脚本。
  2. F=../file1 看起来像变量赋值,但它没有加引号,因此 awk 认为您正在尝试编写一个正则表达式,该正则表达式未被第二个 / 终止。
  3. 没有终止}

该脚本看起来不完整,因为它应该分解为:

# read from file1 until EOF
while ((getline line < "file1") > 0) {
    F="../file2"
    # what now?
}

As far as I can tell, this awk line is broken in several ways.

  1. It should have a terminating ', the ''s wrap the command/script you pass to the awk command to run.
  2. F=../file1 looks like variable assignment, but it's unquoted so awk thinks you're attempting to write a regular expression, which is unterminated by a second /.
  3. There is no terminating }.

The script looks incomplete since it should break down to this:

# read from file1 until EOF
while ((getline line < "file1") > 0) {
    F="../file2"
    # what now?
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文