问题:

我运行几个替换命令作为mavencolorize脚本的核心。 其中一个sed命令使用一个正则表达式,它可以在shell中找到,如下所述 可以在此处找到当前(不工作)的实现。

当我将该命令的一个变体包含到脚本中时,会出现不同的行为:

变式1:

$ sed -re "s/([a-zA-Z0-9./\\ :-]+)/\1/g"

适应脚本:

-re "s/WARNING: ([a-zA-Z0-9./\\ :-]+)/${warn}WARNING: \1${c_end}/g" \

错误: shell输出的信息与我输入$ sed信息相同。 奇怪!?


变式2:

$ sed -e "s/\([a-zA-Z0-9./\\ :-]\+\)/\1/g"

适应脚本:

-e "s/WARNING: \([a-zA-Z0-9./\\ :-]\+\)/${warn}WARNING: \1${c_end}/g" \

错误:

sed:-e表达式#7,char 59:`s’命令的RHS上的引用\\ 1无效

I run several substitution commands as the core of a colorize script for maven .One of the sed commands uses a regular expression which works find in the shell as discussed here .The current (not working) implementation can be found here .When I include one of the variants of the command into the script different behavior occurs:Variant 1:Adapted to the script:Error: The shell outputs the same information as if I would type $ sed .Strange!?Variant 2:Adapted to the script:Error:sed: -e expression #7, char 59: invalid reference \\1 on `s’ command’s RHS

问题:

这个问题已经在这里有了答案:

做一些流编辑以更改讨厌的Parallels图标。 它开发不良,无法嵌入到应用本身中,而不是图像文件。 因此,我找到了这个sed命令,它具有一些良好的反馈:

sudo sed -i.bak s/Parallels_Desktop_Overlay_128/Parallels_Desktop_Overlay_000/g /Applications/Parallels\ Desktop.app/Contents/MacOS/prl_client_app

它返回sed: RE error: illegal byte sequence

谁能解释这意味着什么? 问题出在命令的哪一部分?

This question already has an answer here:RE error: illegal byte sequence on Mac OS X 7 answersDoing some stream editing to change the nasty Parallels icon.It’s poorly developed and embedded into the app itself rather than being an image file.So I’ve located this sed command that has some good feedback:It returns sed: RE error: illegal byte sequenceCan anyone explain what this means?What part of the command is the problem?

问题:

我正在尝试使用

sed -i -e "s/.*seb.*/    \"$ftp_login_template\"/" $ftp_dir

但是我得到这个错误:

sed: -e expression #1, char 34: unknown option to `s'

我不明白为什么,因为这很完美:

sed -i -e "s/.*wbspassword.*/    \"wbspassword\": \"$password\",/" $user_conf

关于我在做什么错的任何想法吗?

这可能是问题吗? ftp_login_template=\\${user}:${password}:24:86::\\/var\\/lib\\/clit.${user}\\/downloads:\\/bin\\/false\\"

I’m trying to usehowever I get this error:I don’t understand why since this works perfectly:Any ideas as to what I’m doing wrong?Could this be the problem?

问题:

我正在尝试替换Mac OS X上Makefile中的字符串以交叉编译到iOS。 该字符串具有嵌入的双引号。 该命令是:

sed -i "" 's|"iphoneos-cross","llvm-gcc:-O3|"iphoneos-cross","clang:-Os|g' Configure

错误是:

sed: RE error: illegal byte sequence

我尝试用双引号,逗号,破折号和冒号转义,但没有任何乐趣。 例如:

sed -i "" 's|\"iphoneos-cross\"\,\"llvm-gcc\:\-O3|\"iphoneos-cross\"\,\"clang\:\-Os|g' Configure

我花了点时间调试问题。 有谁知道如何让sed打印非法字节序列的位置? 还是有人知道非法字节序列是什么?

I’m trying to replace a string in a Makefile on Mac OS X for cross-compiling to iOS.The string has embedded double quotes.The command is:And the error is:I’ve tried escaping the double quotes, commas, dashes, and colons with no joy.For example:I’m having a heck of a time debugging the issue.Does anyone know how to get sed to print the position of the illegal byte sequence?Or does anyone know what the illegal byte sequence is?