How can I remove a line-feed/newline BEFORE a pattern using sed

前端 未结 5 1995
悲哀的现实
悲哀的现实 2021-01-02 17:34

The title already states it:

I want to use some linux one liner (e.g. sed)

to transform

Anytext
{

into

Anyt         


        
5条回答
  •  灰色年华
    2021-01-02 18:32

    This might work for you (GNU sed):

    sed ':a;$!{N;/.*\n{/ba};s/\n{/{/g;P;D' file
    

提交回复
热议问题