Export IP:PORT from random text file to the list

2023-03-03 · Linux

You can use a combination of Linux commands to filter out IP:port pairs from a text file and create a list.

Assuming that the IP:port pairs in the file are separated by a space, you can use the grep command to filter out lines that match the IP:port pattern, and then use the cut command to extract the IP:port pairs from the matched lines. Finally, you can use the sort command to sort the IP:port pairs in ascending order.

Here is an example command that you can use:

grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}:[0-9]{1,5}\b" file.txt | cut -d " " -f 1 | sort

Replace file.txt with the path to your text file. This command will output a sorted list of unique IP:port pairs from the file, with one pair per line.

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.