LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-24-2011, 03:12 PM   #1
porphyry5
Member
 
Registered: Jul 2010
Location: oregon usa
Distribution: Slackware 14.1, Arch, Lubuntu 18.04 OpenSUSE Leap 15.x
Posts: 518

Rep: Reputation: 24
Vim: how sort content of a register


I have appended a series of title lines in "z and want to sort them before pasting them at the start of the document as an index.
Doing :"zsort is accepted by vim but produces no change in "z or ""
 
Old 09-24-2011, 04:22 PM   #2
rigor
Member
 
Registered: Sep 2003
Location: 19th moon ................. ................Planet Covid ................Another Galaxy;............. ................Not Yours
Posts: 705

Rep: Reputation: Disabled
I'm not entirely sure I know what you're trying to do. But I put these lines in a file:

"zabc
"zghi
"zdef


then I opened the file with vim, and executed this command:

Code:
:1,$sort /^"z/
I ended up with the lines sorted as shown here:

Quote:
"zabc
"zdef
"zghi
 
0 members found this post helpful.
Old 09-24-2011, 05:02 PM   #3
porphyry5
Member
 
Registered: Jul 2010
Location: oregon usa
Distribution: Slackware 14.1, Arch, Lubuntu 18.04 OpenSUSE Leap 15.x
Posts: 518

Original Poster
Rep: Reputation: 24
Quote:
Originally Posted by kakaka View Post
I'm not entirely sure I know what you're trying to do.
The lines are already in a register. I appended them to the register one by one from different places in the file. I need to sort the content of the register, then paste the result at the start of the file.

So are you telling me the only way to do it is to paste the register first, then sort them in the buffer? That there is no way to sort them in the register?

Explicitly, in this case
Code:
:0put z
:1,.sort

Last edited by porphyry5; 09-25-2011 at 12:10 PM. Reason: Added solution
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
looking for Open-Source Asset Register Software, IT Equipment and Register Database boninebm Linux - Software 1 09-13-2011 04:56 AM
Working within content management system, how to sort with date >= today? mitchell7man Programming 2 07-18-2009 01:04 AM
Editor comparison: vim VS vim-lite, Cleaning vim Ruler2112 *BSD 4 04-13-2009 04:26 PM
how to put contents of register to line x using vim exec mode leocharre Linux - Software 3 03-19-2008 07:03 PM
Is there a line limit with the sort utility? Trying to sort 130 million lines of text gruffy Linux - General 4 08-10-2006 08:40 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration