Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 在一个sed中匹配负模式和正模式_Regex_Linux_Sed_Regex Negation_Regex Group - Fatal编程技术网

Regex 在一个sed中匹配负模式和正模式

Regex 在一个sed中匹配负模式和正模式,regex,linux,sed,regex-negation,regex-group,Regex,Linux,Sed,Regex Negation,Regex Group,我在使用sed命令时遇到了一个问题,该命令将更改行,其中出现=sometext=并将其更改为另一个模式,但在该行出现https时不会执行。我不知道该如何更改此命令:sed-I的/=\([^=]*\)=/{{\1}}/g'您需要阅读有关匹配行的sed手册:第4章: 以下命令仅在不包含单词“apple”的行中将单词“hello”替换为“world”: sed '/apple/!s/hello/world/' input.txt > output.txt 使用多个块,例如: sed '/=so

我在使用sed命令时遇到了一个问题,该命令将更改行,其中出现
=sometext=
并将其更改为另一个模式,但在该行出现
https
时不会执行。我不知道该如何更改此命令:
sed-I的/=\([^=]*\)=/{{\1}}/g'

您需要阅读有关匹配行的sed手册:第4章:

以下命令仅在不包含单词“apple”的行中将单词“hello”替换为“world”:

sed '/apple/!s/hello/world/' input.txt > output.txt

使用多个块,例如:

sed '/=sometext=/ { /https/b; s/.../.../; }'

类似的问题和答案:可能类似于
awk'/https/&&/=sometext=/{gensub(/=([^=]*)=/,“\1”,$0)}1'文件
,带有呆滞的表情。但现在不能测试。