• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 212
  • Last Modified:

unix sort file

i have file

122.0.101.19 : 2
123.0.160.34 : 12
121.0.236.48 : 32

i want to sort file using: second field after ":"  (2,12,32)

how to do using unix command
0
shahrahulb
Asked:
shahrahulb
2 Solutions
 
tfewsterCommented:
sort -t : -nk 2 yourfile     # Define field seperator as ":"
or
sort -n k 3 yourfile  # Leave the field seperator as whitespace, and treat the :s as the second field
0
 
wesly_chenCommented:
sort -t : -n +1
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now