Sometime while dealing with list of IP Address, we might need to sort IP Address in order. "sort" command can be use for sorting such list. But one must know how to properly use sort command to sort IP Addresses because of its dotted-quad notations.
While using sort command without options, it sorts list of IP Address based upon alphabetic order.
Though using sort -n will sort list of IP Address in numerical order but still it has limitation because of dotted-quad notation of IP Address. Therefore the correct way to sort IP Address is to order the list numerically by considering IP Address as set of four fields having numeric value separated by dot.
Lets take a example:
$ cat ip.txt
9.1.4.4
9.1.4.4
9.1.78.4
149.4.78.4
149.4.78.41
14.4.78.41
10.4.7.41
$ sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 ip.txt
9.1.4.4
9.1.4.4
9.1.78.4
10.4.7.41
14.4.78.41
149.4.78.4
149.4.78.41
where,
While using sort command without options, it sorts list of IP Address based upon alphabetic order.
Though using sort -n will sort list of IP Address in numerical order but still it has limitation because of dotted-quad notation of IP Address. Therefore the correct way to sort IP Address is to order the list numerically by considering IP Address as set of four fields having numeric value separated by dot.
Lets take a example:
$ cat ip.txt
9.1.4.4
9.1.4.4
9.1.78.4
149.4.78.4
149.4.78.41
14.4.78.41
10.4.7.41
$ sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 ip.txt
9.1.4.4
9.1.4.4
9.1.78.4
10.4.7.41
14.4.78.41
149.4.78.4
149.4.78.41
where,
- -t : Set field to . (dot)
- -n : sort list numerically
- -k options: Sort via a key using start and stop position
Thank you so much as you have been willing to share information with us. We will forever admire all you have done here because you have made my work as easy as ABC. https://192-168-i-i.com/
ReplyDeleteMuch thanks for keep this data. check my ip address
ReplyDeletePretty good post. I have just stumbled upon your blog and enjoyed reading your blog posts very much. I am looking for new posts to get more precious info. Big thanks for the useful info. https://192-168-i-i.com/
ReplyDeleteThere is a norm of correspondence which is called an Internet Protocol standard (IP). A straightforward regular similarity would be your road address. With the goal for you to get snail mail at home the sending party must have your right postage information (IP address) in your city (system) or you don't get your mail.192.168.l0.1
ReplyDeleteSince we are more acquainted with the Linux working framework, we can take note of the numerous manners by which Linux contrasts from the universes most well known OS, Microsoft Windows. https://onohosting.com/
ReplyDeleteسئو سایت روسی به بهبود اعتبار و اعتماد برند شما در بازار روسیه کمک می کند. هنگامی که کاربران روسی کلمات کلیدی مرتبط را جستجو می کنند و سایت شما را در بهترین نتایج جستجو می بینند، نسبت به کیفیت و اعتبار محصولات و خدمات شما اطمینان بیشتری خواهند داشت. این اعتماد می تواند منجر به افزایش فروش و وفاداری مشتری شود. با استفاده از ابزارهای تجزیه و تحلیل دقیق و سئو زبان روسی می توانید پیشرفت سایت خود را رصد کرده و استراتژی های بهینه تری برای جذب مشتری در بازار روسیه ارائه دهید. به طور کلی، سئوی روسی ابزاری قدرتمند برای رشد و موفقیت در بازار رقابتی روسیه است.
ReplyDelete