I have a file that has three columns, and several rows. The second column is made up of numeric values, and I want to rearrange it, in ascending order, but without affecting the previous and subsequent column.
exemplo do arquivo:
7.31937 736 /tmp/ref13
7.3223 5373 /tmp/ref13
7.32816 768 /tmp/ref13
7.32955 5370 /tmp/ref10
o que eu quero:
7.31937 736 /tmp/ref13
7.3223 768 /tmp/ref13
7.32816 5370 /tmp/ref13
7.32955 5373 /tmp/ref10
I have tried sort -k2 -n
, but this command is moving the other columns = (
Does anyone help me? Thanks!
Edit:
[Resolvido]Comando utilizado:
'paste -d' ' <(awk '{print $1}' nome_arquivo) <(awk '{print $2}' nome_arquivo | sort -n) <(awk '{print $3}' nome_arquivo)'