How can i append the next line to a previous line in a file, delimited by pipe symbol?
Expectd Input — content of input.txt
ABC
BCD
DEF
EFG
FGH
Expectd Output — content of output.txt
|ABC|BCD|
|BCD|DEF|
|DEF|EFG|
|EFG|FGH|
|FGH||
is a good start, but it does not add your desired delimiters. For that, try:
(Or any of many other ways to insert the
|symbol between the fields! This version emits|FGH|instead of|FGH||on the final line.)Or: