|
|
egrep "CHANGED" node_exporter.txt - R0 q9 U7 z' L0 `7 y
Binary file node_exporter.txt matches" y# J% m5 [4 g" n2 d; \
/ Q* s9 A/ h. v9 U" v9 c
$ ^2 c; z$ x! t* U. Q! acat node_exporter.txt |grep 12.24
$ U' B* R! C- O1 oBinary file (standard input) matches
+ D; G' Z( w; Q2 k3 i+ ]9 c5 q4 P2 a& t8 G; _4 ]+ p" ]
3 S ]$ f$ c( i( q: n8 Q6 i
傻眼了,这种还能报错。; Q6 z4 m7 ]' {! K0 }
2 t; c+ p) u7 z6 B后来百度了下。好像这种报错还挺奇怪。加几个参数就好了:8 V7 |3 J& y. N( ~/ r! N% e
7 P2 R9 ?8 O2 s% E" t' Y在egrep 中加-a -i 参数:
! v; N) N$ n' Z# T# Z R3 ^- a" H( {8 z3 s( e* U$ \+ r
egrep -a -i "CHANGED" node_exporter.txt 0 @% E- S8 h8 U" r2 c
12.24.13.65 | CHANGED | rc=0 >>
: b8 g& x+ [* C5 R) E5 n12.24.13.66 | CHANGED | rc=0 >>
9 {' D7 H% o, }1 Z: J. t/ d6 ]3 z% ]/ t& O, u
7 G/ w: P3 R# V# T) d" c% ?成功了。 ! k& @' ]1 G# N, x* d6 G& T5 d; L& ~
' U& K: D9 [% ~' t: Z/ L# u+ j9 u; C: M V, h
背景是因为我们通过ansible跑脚本之后出来的结果。! q/ d; M4 t- V" ~/ M, M$ g
再使用egrep 或者grep 均报此错误。1 V5 f7 C; u0 e8 S7 I
请采用上述方式解决问题。
& `8 @; }% g# w6 H- F
& _" R2 y* I, y& d9 \6 k* h+ a+ `6 `" c
|
|