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

'hasOwnProperty' in javascript -

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

How to understand 2 main() functions after using uftrace to profile the C++ program? -