Sort a file in Vi

Sort

:%sort


Sort in reverse

:%sort!

Sort numerically

:%sort n

Sort, removing duplicates

:%sort u

Comments are closed.