Replace slash in Bash

前端 未结 5 1806
迷失自我
迷失自我 2020-12-28 12:54

Let\'s suppose I have this variable:

DATE=\"04/Jun/2014:15:54:26\".

Therein I need to replace / with \\/ in order to

5条回答
  •  北海茫月
    2020-12-28 13:21

    here you go:

    kent$  echo "04/Jun/2014:15:54:26"|sed 's#/#\\/#g'  
    04\/Jun\/2014:15:54:26
    

    your tr line was not correct, you may mis-understand what tr does, tr 'abc' 'xyz' will change a->x, b->y, c->z,not changing whole abc->xyz..

提交回复
热议问题