Shell to remove a newline char from selected rows in a file.

Greetings!

Can we automate the process of removing a newline char from selected rows in a fixed width file using a shell?
Input is like

abcd1234
xyzd1234
abcd
a1b2c3d4
abcd1234
xyzd1234
xx
abcd1234

Expected output -

abcd1234xyzd1234
abcda1b2c3d4abcd1234xyzd1234
xxabcd1234

Note - its like if in above case no of characters in a line -eq 9 (including new line char) remove newline char else not.

Appreciate your help!
Thanks

Hi, what have you tried so far?

This post is duplicated. There is one identical in UNIX for Dummies Questions & Answers

Regards,
Birei.

echo "abcd1234
xyzd1234
abcd
a1b2c3d4
abcd1234
xyzd1234
xx
abcd1234" | awk '{if(length($1)==8){printf("%s",$1)}else{printf("\n%s",$1)}}'