I have lots of /etc/hosts line need to be modify.
Below is example.
original file:
1.1.1.1 A a
1.1.1.2 B b
1.1.1.3 C c
1.1.1.4 D d
1.1.1.5 E e
1.1.1.6 F f
1.1.1.7 G g
request of modify:
2.1.1.3 B b
2.1.1.54 E e
2.1.1.25 G g
Desired output:
1.1.1.1 A a
2.1.1.3 B b
1.1.1.3 C c
1.1.1.4 D d
2.1.1.54 E e
1.1.1.6 F f
2.1.1.25 G g
Try to using sed to run, but don't know how to handle more than one line in /etc/hosts. should I using for loop with sed?