I have a file(file.txt) containing the following data:
192.168.10.1/16, 22, 3265, tcp
172.144.32,2/34, 22, 21, udp
10.128.16.234/8, 0, 20, icmp
I need to sort this by cloumn[0], cloumn[1] and column[2]
I have a file(file.txt) containing the following data:
192.168.10.1/16, 22, 3265, tcp
172.144.32,2/34, 22, 21, udp
10.128.16.234/8, 0, 20, icmp
I need to sort this by cloumn[0], cloumn[1] and column[2]
Copyright © 2021 Jogjafile Inc.
My solution is to create a list of tuples (one tuple for each line)like this:
Where the
data_in_column_of_interest
is any datatype andentire_line
is string.then just sort this list:
Input: File containing:
output: a list of strings: