It happens that you have a list and you'd like to combine multiple lines in one. For example, a list like this one:
list
sh
Mark
Smith
London
Sarah
Ruffle
Glasgow
Paul
Thompson
Liverpool
....
And have something like that:
list ordered
sh
Mark - Smith - London
Sarah - Ruffle - Glasgow
Paul - Thompson - Liverpool
How to achieve it? Use this command:
command
sh
sed 'N;N;s/\
/ - /g' list.txt
Use one extra "N" for every line you want to merge. It's like (N-1). So, if you want to merge 3 lines like in this example, you need 2 N's. If you'd like to merge 2 lines, you just need 1 N, and so. Happy merging :)