Sed/Awk/Cut GNU transform text lines to single line <p>I have the following type of data:</p> <pre><code>3869|Jennifer Smith 10413 NE 71st Street Vancouver, WA 98662 360-944-9578 jsmith@yahoo.com|1234567890123456|03-2013|123 -- 3875|Joan L Doe 422 1/2 14th Ave E Seattle, WA 98112 206-322-7666 jldoe@comcast.net|1234-1234-1234-1234|03-2013|123 -- 3862|Dana Doe 24235 NE 7th Pl Sammamish, WA 98074 425 868-2227 jsmith@hotmail.com|1234567890123456|03-2013|123 -- 3890|John Smith 10470 SW 67th Ave Tigard, OR 97223 5032205213 john.smith@gmail.com|1234567890123456|03-2013|123 </code></pre> <p>I need to transform it to:</p> <pre><code>3869|Jennifer Smith|10413 NE 71st Street|Vancouver, WA|98662|360-944-9578|jsmith@yahoo.com|1234567890123456|03-2013|123 3875|Joan L Doe|422 1/2 14th Ave E|Seattle, WA|98112|206-322-7666|jldoe@comcast.net|1234-1234-1234-1234|03-2013|123 3862|Dana Doe|24235 NE 7th Pl|Sammamish, WA|98074|425 868-2227|jsmith@hotmail.com|1234567890123456|03-2013|123 3890|John Smith|10470 SW 67th Ave|Tigard, OR|97223|5032205213|john.smith@gmail.com|1234567890123456|03-2013|123 </code></pre> <p>or better:</p> <pre><code>3869|Jennifer Smith|10413 NE 71st Street|Vancouver|WA|98662|360-944-9578|jsmith@yahoo.com|1234567890123456|03-2013|123 3875|Joan L Doe|422 1/2 14th Ave E|Seattle|WA|98112|206-322-7666|jldoe@comcast.net|1234-1234-1234-1234|03-2013|123 3862|Dana Doe|24235 NE 7th Pl|Sammamish|WA|98074|425 868-2227|jsmith@hotmail.com|1234567890123456|03-2013|123 3890|John Smith|10470 SW 67th Ave|Tigard|OR|97223|5032205213|john.smith@gmail.com|1234567890123456|03-2013|123 </code></pre> <p>any idea how to automate this using GNU sed, awk, cu or perl/python whatever... Thank you!</p>