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

Sort data with vi

I have a file with data in it like this:
/home/csu/csu-003.tow
/home/csu/csu-083.tow
/home/csu/csu-236.tow
/home/csu/csu-787.tow
I would like to put the lines in numerical order. Is there a way to do this with vi?
0
omcr
Asked:
omcr
1 Solution
 
ellesdCommented:
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.
0
 
omcrAuthor Commented:
That did it. Thanks
0

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