Joining two consecutive lines using awk or sed

前端 未结 7 2020
一生所求
一生所求 2020-12-14 17:54

How would I join two lines using awk or sed?

for e.g.:

I have data that looks like this:

abcd
joinabcd
efgh
joinefgh
ijkl
j         


        
7条回答
  •  别那么骄傲
    2020-12-14 18:21

    Some improvement to the "sed" script above that will take the following: 1008
    -2734406.132904 2846
    -2734414.838455 4636
    -2734413.594009 6456
    -2734417.316269 8276
    -2734414.779617

      and make it :    
    

    1008 -2734406.132904
    2846 -2734414.838455
    4636 -2734413.594009
    6456 -2734417.316269
    8276 -2734414.779617

      the "sed" is : "sed 'h;s/.*//;G;N;s/\n/ /g'"
    

提交回复
热议问题