Transpose short columns to row and rearrange the positions using awk/sed -
I have the current dataset as given below: 11 48 5300 8000 1 0 ht2 Ht2 11 49 5300 8000 1 0 HT 2 HT 2 11 50 5300 8000 2 HT 2 HT 2 11 51 5300 8000 2 HT 2 HT 3 11 52 5300 8000 2 0 HT 2 HT 3 Re: I want to organize I like the following data: 11 48 5300 8000 1 0 ht2 HT 2 11 49 5300 8000 1 0 HT 2 HT 2 11 50 5300 8000 2 0 HT 2 HT 2 11 51 5300 8000 2 HT 2 HT 3 11 52 5300 8000 2 HT2 HT 3 I appreciate the depth of any of your help / suggestions I thank you in advance You want to read three input lines and write them as a line. Awk has a function, getline , making it easy: $ awk '{a = $ 0; get line; B = $ 0; get line; Print A, B, $ 0} 'datasets 11 48 5300 8000 1 0 HT 2 HT 2 11 49 5300 8000 1 HT 2 HT 2 11 50 5300 8000 2 HT 2 HT 2 11 51 5300 8000 2 HT 2 HT 3 11 52 5300 8000 2 HT 2 HT 3 to each awk command instead: a = $ 0; Save the value of the first line in variable one . meet; Read in the second row. b = $ 0; variable b . Meet; Read in t...