How can I align data into pretty columns relative to given word?
For example, I have output of the route -n command:
default via 172.20.99.254 dev eth0
87.33.17.71 dev tun0 scope link
89.223.15.12 via 172.20.99.254 dev eth0 src 172.20.99.74
172.20.9.0/24 dev eth0 proto kernel scope link src 172.20.99.74
65.46.5.89 dev tun0 scope link
192.168.11.0/24 dev tun0 scope link
45.211.111.7 dev tun0 scope link
and I would like to align it by the word dev, so that the column containing the word dev is aligned:
default via 172.20.99.254 dev eth0
87.33.17.71 dev tun0 scope link
89.223.15.12 via 172.20.99.254 dev eth0 src 172.20.99.74
172.20.9.0/24 dev eth0 proto kernel scope link src 172.20.99.74
65.46.5.89 dev tun0 scope link
192.168.11.0/24 dev tun0 scope link
45.211.111.7 dev tun0 scope link
I cannot just naively replace fist space character with a tab, because sometimes I need 1 tab, other times I need 3 tabs.