linux - How can I use awk for modify a column based in the first column? -
i have data this, , need automatize simple task. need make second value of row, become same first cell in next row in sequence this:
first second 1 2 4 6 10 12 25 28 30 35
become
first second 1 4 4 10 10 25 25 30 30 35
$ awk 'nr==1; nr>2{print p[1], $1} {split($0,p)} end{print p[1], p[2]}' file first second 1 4 4 10 10 25 25 30 30 35
Comments
Post a Comment