sub(/ ~/,"");
Remove'~' and all following spaces (replaced by empty sting "").
($0~/\|$/?ORS:"")
If the input line ends with '|' then the value of the expression ORS, else the value is an empty string.
ORS is a variable that contains the Output Record Separator that is used par awk when printing data to stdout (with print statement); The default value of ORS is '\n'.
printf $0 ($0~/\|$/?ORS:"")
Displays the input line, followed by a new line (ORS) if ending with '|'.
The 3 commands are varitions a the same technique.
I asked you because one of the developers of my application was called by your name and is from grenoble. anyways, looks like you have a vast knowledge of unix scripting. do you mind, telling me where do you refer????