string - How can join consecutive non-empty lines using sed/awk? -


how can join consecutive non-empty lines single lines using sed or awk? example given of trying do.

input:

aaa ff gg bbb eee eee ss gg dd  aaa ff gg bbb eee eee ss gg dd  aaa ff gg bbb eee eee ss gg dd 

converts

aaa ff gg bbb eee eee ss gg dd  aaa ff gg bbb eee eee ss gg dd  aaa ff gg bbb eee eee ss gg dd 

if perl okay:

$ perl -00 -pe 's/\n(?!$)/ /g' ip.txt aaa ff gg bbb eee eee ss gg dd  aaa ff gg bbb eee eee ss gg dd  aaa ff gg bbb eee eee ss gg dd 

Comments

Popular posts from this blog

android - ConstraintLayout: Realign baseline constraint in case if dependent view visibility was set to GONE -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -

c# - Update a combobox from a presenter (MVP) -