Sort data with vi

Posted on 2003-02-21
Medium Priority
Last Modified: 2013-12-26
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?
Question by:omcr
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

ellesd earned 80 total points
ID: 7996750
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.

Author Comment

ID: 7997278
That did it. Thanks

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question