Questions on removing unexpected line breaks

view story

http://www.unix.com – I am a newbie in Linux and I am having trouble with a piece of data on hand. The source data is like Code: a|b|c|d e|f|g |h i|j|k|l m|n|o |p 1|2|3|4 5|6|7| 8 a|b|c|d e|f|g|h For each line, there should be 4 fields separated by the "|", but unfortunately there are unexpected line breaks that make it a mess. :wall: How to clean up the mess by reformating the lines to make it like Code: a|b|c|d e|f|g|h i|j|k|l m|n|o|p 1|2|3|4 5|6|7|8 a|b|c|d e|f|g|h I guess it should be like checking the number of "|" in each line and if the number of "|" in a line is (HowTos)