Article 5SZTF URGENT -task is to find all distinct IP addresses from all the files in the /root/u01/testing/ directory and print them in lexicographical

URGENT -task is to find all distinct IP addresses from all the files in the /root/u01/testing/ directory and print them in lexicographical

by
urs428@gmail.com
from LinuxQuestions.org on (#5SZTF)
Hi friends,

I need sample program either in bash or python

Question:You have a hierarchy of directories and somefiles in some of those directories.

e.g /u01/testing/dir1/file1.txt,file2.txt....
/u01/testing/dir2/file.txt ,file1.txt ....
/u01/testing/dir2/file2.txt .......
some of these files contain IP addresses inside the text. An IP address is a string of form x.x.x.x where x is a number from 0 to 255(inclusive).
example file.txt that looks like below.

file1.txt
---------
hello mike 127.0.0.1
this is some example 128.99.107.55
file with some correct and incorrect 128.128.4.11 ip 0.11.1115.78 addresses

file1.txt
---------
hello rocky 127.65.64.1 127.0.64.1 127.0.0.1
example 128.57.107.76 128.57.907.70
file with some correct and incorrect 67.128.4.11 ip 7.7.7.8 addresses

file5.txt
---------
hello rocky 127.69.64.1 127.0.68.1 127.0.1.1
example 128.57.10.76 128.57.9079.70
file with some correct and incorrect 67.128.4.11 ip 7.78.7.8 addresses

task is to find all distinct IP addresses from all the files in the /root/u01/testing/ directory and print them in lexicographical order.

output should be contain only valid ip addresses
-----------------latest?d=yIl2AUoC8zA latest?i=Lb6REJsYTqY:5vtdgkf7Aq0:F7zBnMy latest?i=Lb6REJsYTqY:5vtdgkf7Aq0:V_sGLiP latest?d=qj6IDK7rITs latest?i=Lb6REJsYTqY:5vtdgkf7Aq0:gIN9vFw
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments