sed 无法匹配等号

sed 无法匹配等号

这是有效的:

$ sudo gitlab-runner list 2>&1 | grep 'Token' | sed -e 's/Token//'
Python 2.7.14                                       Executor=docker =bccdbf31ef6bc74b2ae4980d8eccea URL=http://something
Docker                                              Executor=docker =5b06f034f48d3543848d7d209ce80c URL=http://something
Ansible                                             Executor=docker =e2215647f2c9981c8d74abaf324983 URL=http://something

这不起作用:

$ sudo gitlab-runner list 2>&1 | grep 'Token' | sed -e 's/Token=//'
Python 2.7.14                                       Executor=docker Token=bccdbf31ef6bc74b2ae4980d8eccea URL=http://something
Docker                                              Executor=docker Token=5b06f034f48d3543848d7d209ce80c URL=http://something
Ansible                                             Executor=docker Token=e2215647f2c9981c8d74abaf324983 URL=http://something

这是啥?

我在用:

$ sed --version
sed (GNU sed) 4.2.2
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Jay Fenlason, Tom Lord, Ken Pizzini,
and Paolo Bonzini.
GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.
E-mail bug reports to: <[email protected]>.
Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.

编辑

看起来输出确实有奇怪的字符:

$ sudo gitlab-runner list 2>&1 | grep 'Token' | od -c

0000340   o   c   k   e   r       T   o   k   e   n 033   [   0   ;   m
0000360   =   5   5   6   1   a   c   1   c   3   0   9   4   c   3   8
0000400   0   e   1   a   3   0   e   3   5   0   2   5   d   a   5    
0000420   U   R   L 033   [   0   ;   m   =   h   t   t   p   :   /   /

相关内容