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

Sort data with vi

I have a file with data in it like this:
I would like to put the lines in numerical order. Is there a way to do this with vi?
1 Solution
Yes there is.  Place your cursor a the line from which you want to start sorting (probably the first line).  Then press !G and type sort.  You wont see the ! when you type it, but when you press G the ! appears at the bottom line.  Then type sort and press enter ( you can also supply arguments after the sort i.e. sort -r to sort in reverse).

Hope this works out.
Let me know.
omcrAuthor Commented:
That did it. Thanks

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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