Question: In awk, how can I do this:

Input: 

```
1  a  f  1  12  v  
2  b  g  2  10  w  
3  c  h  3  19  x  
4  d  i  4  15  y  
5  e  j  5  11  z  

```

Desired output, by sorting numerical value at `$5`: 

```
1  a  f  2  10  w  
2  b  g  5  11  z  
3  c  h  1  12  v  
4  d  i  4  15  y  
5  e  j  3  19  x  

```

**Note** that the sorting should **only** affecting `$4`, `$5`, and `$6` (based on value of `$5`), in which the previous part of table remains intact.

Answer: 
This could be done in multiple steps with the help of [`paste`](https://www.gnu.org/software/coreutils/manual/html_node/paste-invocation.html):

```
$ gawk '{print $1, $2, $3}' in.txt > a.txt
$ gawk '{print $4, $5, $6}' in.txt | sort -k 2 -n b.txt > b.txt
$ paste -d' ' a.txt b.txt
1 a f 2 10 w
2 b g 5 11 z
3 c h 1 12 v
4 d i 4 15 y
5 e j 3 19 x

```
Personally, I find using `awk` to safely sort arrays of columns rather tricky because often you will need to hold and sort on duplicate keys. If you need to selectively sort a group of columns, I would call `paste` for some assistance:

```
paste -d ' ' <(awk '{ print $1, $2, $3 }' file.txt) <(awk '{ print $4, $5, $6 | "sort -k 2" }' file.txt)

```

Results:

```
1 a f 2 10 w
2 b g 5 11 z
3 c h 1 12 v
4 d i 4 15 y
5 e j 3 19 x

```