awk: convert column to row in a specific way

view full story

http://www.unix.com – Hi all! I have this kind of output: Code: a1|b1|c1|d1|e1 a2|b2|c2 a3|b3|c3|d3 I would like to transpose columns d and e (when they exist) in column c, and under the row where they come from. Then copying the beginning of the row. In order to obtain: Code: a1|b1|c1 a1|b1|d1 a1|b1|e1 a2|b2|c2 a3|b3|c3 a3|b3|d3 I have no idea how to do that ... If someone could help me, it would be great ! Thanks ! (HowTos)