2016-09-20 199 views
0

使用轉義序列我想;通過TERMINATED BY '\034' STORED AS TEXTFILE;在sed命令

我使用sed命令,但是它的通過;

sed "s|;|TERMINATED BY '\034' STORED AS TEXTFILE|" 

更換\0我試圖\\034,但它不工作來代替。

回答

0

使用此sed

sed "s|;|TERMINATED BY '\\\034' STORED AS TEXTFILE|" 
+0

精湛的男人!有效。非常感謝 :) –

0

如果perl的解決方案是好的,q operator有利於在這種情況下

$ echo 'abc ; xyz' | perl -pe "s/;/q(TERMINATED BY '\034' STORED AS TEXTFILE)/e" 
abc TERMINATED BY '\034' STORED AS TEXTFILE xyz