sorting output bash

Shell
# Use sort command
input_text | sort
# or
input_text | sort -r
# For reverse
Source

Also in Shell: