How to substitute dates in Perl?

前端 未结 3 1112
甜味超标
甜味超标 2021-01-21 19:12
perl -pi.back -e \'s/2013/07/31-05:54:14/2014/07/31-00:00:00/g;\' /tmp/ranjan/replace.SEL

I\'m using the above one liner to replace the date from

3条回答
  •  死守一世寂寞
    2021-01-21 19:24

    You have to change your delimeter or you have properly escape your regexp strings.

    The dilmeter could be anything non printable, i like to use !.

    like this:

    s!2013/07/31-05:54:14!2014/07/31-00:00:00!g;
    

提交回复
热议问题