in my ksh script I need to add the following task ( OS - linux/solaris )
I have the following file
 more test.txt
 /etc/backup/app 172.1.120      172.110.120 
 /etc/backup/app 172.1.120.12   172.110.120.98 
 /etc/backup/app 192.1.120      192.120.120 
 /etc/backup/app 172.1.120.1      172.110.120.7 
 /var/log/df     193.23.2       193.23.2
 /var/log/df     193.23.2.111   193.23.2.159
how to locate all IP's with 4 octets in the beginning of the file , and then the others IP's with 3 octets
Remark – sort IP's will be according to the second field
Example of requested file ( after sort )
    more test.txt
    /etc/backup/app 172.1.120.12   172.110.120.98 
    /etc/backup/app 172.1.120.1    172.110.120.7
    /var/log/df     193.23.2.111   193.23.2.159
    /etc/backup/app 172.1.120      172.110.120 
    /etc/backup/app 192.1.120      192.120.120 
    /var/log/df     193.23.2       193.23.2
Solution can be done with sort or ksh/awk/sed/perl one liner ...etc
