linux 特殊字符处理 sed awk \047 \001

hengxie00 2017-09-07

manascii

[[email protected]~52]#cat-T000000_0|grep862298034006830|sed's/\001/||/g'

862298034006830M6820wifi182.114.191.1470149013500000980007

862298034006830\N\N182.114.191.1470149013500000980007

[[email protected]~53]#cat-T000000_0|grep862298034006830|awk-F'\001''BEGIN{OFS="|"}{NF=NF;print}'|head-n10

862298034006830|M6820|wifi|182.114.191.147|0|1490|135|0|0|0|0|0|980007

862298034006830|\N|\N|182.114.191.147|0|1490|135|0|0|0|0|0|980007

[[email protected]~54]#cat-T000000_0|grep862298034006830

862298034006830M6820wifi182.114.191.1470149013500000980007

862298034006830\N\N182.114.191.1470149013500000980007

[[email protected]~56]#cat-v000000_0|grep862298034006830

862298034006830^AM6820^Awifi^A182.114.191.147^A0^A1490^A135^A0^A0^A0^A0^A0^A980007

862298034006830^A\N^A\N^A182.114.191.147^A0^A1490^A135^A0^A0^A0^A0^A0^A980007

[[email protected]~57]#

总结了一下,sed好像不支持\001这种方式的土人白金,而awk支持,sed有空看一下man文档再想想有没有别个办法;

也不知道vim有没有方式处理;

相关推荐