Removing new line after a particular text via bash/awk/sed/perl

前端 未结 8 1035
迷失自我
迷失自我 2021-01-02 00:22

I would like to remove all the newline character that occurs after a partiular string and replace it with a tab space. Say for instance my sample.txt is as follows



        
8条回答
  •  北海茫月
    2021-01-02 00:30

    Mmm. not sure this fits your requirements, but I'd do this in vim:

    :g/^foo$/join
    

    Or, if foo could be anywhere on a line:

    :g/foo$/join
    

    Of course, :%s/foo\n/foo\t/g will do nicely too

提交回复
热议问题