English 中文(简体)
如何在Jenkinsfile管道中逃脱这一 command的指挥?
原标题:How to escape this sed command in a Jenkinsfile Pipeline?

Im从事简单的替代工作,这项工作在指挥线上课以罚款:

sed "s/pub Url =.*/pub Url =  https://example.com:3207 ;/g" myfile.ts

我试图在一份Jenkinsfile中管理,像40人一样,后来我无法拿越狱的话。

Pretty sure it will look something like this:

www.un.org/Depts/DGACM/index_french.htm Url = https:////example.com:3207/;/g/”我的档案。

www.un.org/Depts/DGACM/index_spanish.htm 然而,这造成了以下错误:。

WorkflowScript: 4: unexpected char: @ line 4, column 49. ub Url =.*/pub Url = \ https:\/\/ex

我感到,我曾尝试过数十种变体,但没有任何东西在发挥作用。

这里是最常见的错误之一。

sed:-e expression #1, char1: 不详的指挥:`'

我确实需要一名管道专家,他们可能确切看到我错做什么,并知道什么地方可以引用。

As noted here: https://gist.github.com/Faheetah/e11bd0315c34ed32e681616e41279ef4 this is not uncommon to fight this type of stuff in the pipeline files and it seems like it s just trial and error.

最佳回答

Ok after much trial and error, this is working.

象我这样,我不得不在指挥周围使用 >。 我不需要干涉!

sh sed "s/pub Url =.*/pub Url = \ https:\/\/example.com:3207\ ;/g" afile.txt

希望这对今后打击这一祸害的人是有益的!

问题回答

令人惊讶的是,通过审判和错误,我了解到,即使在的三联字中,反弹需要加倍。 因此,解决你问题的机械办法希望能找到。

sh    sed "s/pub Url =.*/pub Url =  https:\/\/example.com:3207 ;/g" myfile.ts   

然而,通过使用不同的限定词,你可以避免冲锋枪。 确实,确保你们选择在你需要处理的文本中出现错误。

sh    sed "s%pub Url =.*%pub Url =  https://example.com:3207 ;%g" myfile.ts   

更为复杂的是,你试图在<条码>上使用背书。 如果你真心地试图

sh    sed  s/foo(bar|baz)/quux1/  file   

页: 1

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 1: unexpected char:    @ line 1, column 17.
sh    sed  s/foo(bar|baz)/quux1/  file   
                 ^

看起来,解决办法是把这些反弹增加一倍。

sh    sed  s/foo\(bar\|baz\)/quux\1/  file   

在这方面增加更多内容...... 我有一个议题是sed -i s//_//g abc.txt。 • 在CLI进行控制,但结果是<><>unxpected char> mis in jenkins, 因此,必须替换:

sed -i  s/\_///g  abc.txt 

with

sed -i "s/\_/\//g" abc.txt

To remove this error from jenkins.





相关问题
how to tell sed "dot match new line"

I can t figure how to tell sed dot match new line: echo -e "one two three" | sed s/one.*two/one/m I expect to get: one three instead I get original: one two three

sed: using search pattern in output

I d like to use the search pattern in the output part of a sed command. For instance, given the following sed command: sed /HOSTNAME=/cHOSTNAME=fred /etc/sysconfig/network I d like to replace the ...

Text manipulation and removal

I have text files generated by one of my tools with structure shown below. 1 line text (space) multiple lines text (space) multiple lines text nr 2 ----------------------------------------------------...

Parse players currently in lobby

I m attempting to write a bash script to parse out the following log file and give me a list of CURRENT players in the room (so ignoring players that left, but including players that may have rejoined)...

how to use sed, awk, or gawk to print only what is matched?

I see lots of examples and man pages on how to do things like search-and-replace using sed, awk, or gawk. But in my case, I have a regular expression that I want to run against a text file to extract ...

Bulk Insert Code Before </body> Tag in 100 Files

I d like to insert <?php include_once( google_analytics.php ); ?> before the closing body tag of about 100 php files. Unfortunately the person who made the site didn t make a header or ...

Extract float from text line with sed?

I am issuing a sed replace on a line, trying to extract a particular floating-point value, but all that appears to be matched is the right-side of the decimal Text Line: 63.544: [GC 63.544: [DefNew: ...