-3

Hello when i want to execute more /etc/domainips commands on my ssh, I want to get the results like = sort by username.

Hello when i execute more /etc/domainips commands on my ssh the result showed up like this

a.com: D-user
b.com: B-user
c.com: A-user
d.com: C-user

I want to get the results like this = sort by username.

c.com: A-user
b.com: B-user
d.com: C-user
a.com: D-user

Please help me to do this.

Barmar
  • 741,623
  • 53
  • 500
  • 612
  • Does [this](https://stackoverflow.com/questions/4262650/linux-shell-sort-file-according-to-the-second-column) answer your question? – tink Aug 14 '23 at 05:50
  • Or [this](https://stackoverflow.com/questions/6438896/sorting-data-based-on-second-column-of-a-file)? Or any of the other umpteen dupes? – tink Aug 14 '23 at 05:53

1 Answers1

-1

Pipe the result of sort to more:

sort -k 2 /etc/domainips | more
Barmar
  • 741,623
  • 53
  • 500
  • 612