I do have a problem that is too difficult for me, but believe it can be solved very easily in awk.
My data looks like this:
8377885 8384365 8385357 8385877 @ 8378246 8384786 8385450 8386102
66999065 66999928 67091529 @ 66999090 67000051 67091593
It's different lines that that have '@' exactly in the middle of them. I want to:
1.Combine line elements separated with '@' from first to last;
2.Print all combined elements as column.
Preferred output would look like this:
8377885 8378246
8384365 8384786
8385357 8385450
8385877 8386102
8390268 8390996
66999065 66999090
66999928 67000051
67091529 67091593
Hope someone could help me with this.
Here you have a one-liner:
awk 'BEGIN { FS = "[@ ]+" } { for (i=1;i<=NF/2;i++) { printf "%s %s\n", $i, $(NF/2+i) } }' infile
That yields:
8377885 8378246
8384365 8384786
8385357 8385450
8385877 8386102
66999065 66999090
66999928 67000051
67091529 67091593
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With