【问题标题】:Grep: Issue with null byteGrep:空字节问题
【发布时间】:2022-11-03 06:39:51
【问题描述】:

我在 bash 脚本中有以下命令。

GREP_RESULT=$(grep -zoP "\.global LIST(.|\n)*-1\Z" part1.s)

我收到以下错误。

warning: command substitution: ignored null byte in input

我已经尝试了this 帖子中提出的解决方案,将其更改为以下内容。

GREP_RESULT=$(tr -d '\0' < grep -zoP "\.global LIST(.|\n)*-1\Z" part1.s)

这反过来导致以下错误。

grep: No such file or directory

解决第一个错误的正确方法是什么?

【问题讨论】:

    标签: bash shell grep sh


    【解决方案1】:

    更新:

    来自 OP 的评论:grep -z 正在添加

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多