I have SQL output with multiple results:
1 OI 021 141012 1321 0001242 4S 2 0080004 5 001 00014 6 000001 000000000000016973 6 0529540437 0000000000
2963526113
test 7 8 000000001 9
1 OI 021 141012 1321 0001242 4S 2 0080004 5 001 00014 6 000001 000000000000016973 6 0529540437 0000000000
2963526113
test 7 8 000000001 9
The question is how to make delimiter or something else and to join every second and third row to the first and turn every SQL query to one row them in that output:
1 OI 021 141012 1321 0001242 4S 2 0080004 5 001 00014 6 000001 000000000000016973 6 0529540437 00000000002963526113 test 7 8 000000001 9
1 OI 021 141012 1321 0001242 4S 2 0080004 5 001 00014 6 000001 000000000000016973 6 0529540437 00000000002963526113 test 7 8 000000001 9
You can use
paste
with as many-
as lines you want to join:or
It returns:
If you need to use another delimiter instead of space, use
-d
: for example,paste -d"|" - - - <file
.