I want to join lines in a file as below.
Input
01EPH087362 SHHFHDH 3673
63737
Dhdhj
01EPH636363 DHHDH
3637737
Hshshhd
01EPH7373838 HDJJDJ
Output
01EPH087362 SHHFHDH 3673 63737 Dhdhj
01EPH636363 DHHDH 3637737Hshshhd
01EPH7373838 HDJJDJ
I want the output as above; basically every line should start with 01EPH.
I have awk and sed but no luck. Please help if you know.
$ awk '/^01EPH/{if (NR>1) print buf; buf=$0; next} {buf = buf OFS $0} END{print buf}' file
01EPH087362 SHHFHDH 3673 63737 Dhdhj
01EPH636363 DHHDH 3637737 Hshshhd
01EPH7373838 HDJJDJ
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With