Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
How to ONLY sort part of a file and keep the format?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  10 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
William Fugh  
View profile  
 More options Sep 13 2012, 3:05 pm
From: William Fugh <viarm...@gmail.com>
Date: Fri, 14 Sep 2012 05:05:20 +1000
Local: Thurs, Sep 13 2012 3:05 pm
Subject: [Help] How to ONLY sort part of a file and keep the format?

Hi folks,

As the title. How to sort only the non-TAB-beginning line(s) of a TAB-Based
file like the below and keep the format? thanks!
#
--------------------------------------------------------------------------- ---
Origin:
#
--------------------------------------------------------------------------- ---
for openers
want out
a load of old cobblers
want for
        5. one
        6. two
        7. three
muck about
muck around
        20. one
        21. two
        22. three
bottom on
        24. one
        25. two
        26. three
lark around
lark about
darkred
        29. one
        30. two
        31. three
#
--------------------------------------------------------------------------- ---
Expect to see after sorting:
#
--------------------------------------------------------------------------- ---
a load of old cobblers
for openers
want for
want out
        5. one
        6. two
        7. three
muck about
muck around
        20. one
        21. two
        22. three
bottom on
        24. one
        25. two
        26. three
darkred
lark about
lark around
        29. one
        30. two
        31. three
#
--------------------------------------------------------------------------- ---

BRs,
---------
William


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christian Brabandt  
View profile  
 More options Sep 13 2012, 3:21 pm
From: Christian Brabandt <cbli...@256bit.org>
Date: Thu, 13 Sep 2012 21:21:41 +0200
Local: Thurs, Sep 13 2012 3:21 pm
Subject: Re: [Help] How to ONLY sort part of a file and keep the format?
Hi William!

On Fr, 14 Sep 2012, William Fugh wrote:

I think, this will do:
:v/^^I/.,/^^I/-sort

where ^I is a literal tab.

regards,
Christian
--


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bee  
View profile  
 More options Sep 13 2012, 3:31 pm
From: Bee <fo...@calcentral.com>
Date: Thu, 13 Sep 2012 12:31:37 -0700 (PDT)
Local: Thurs, Sep 13 2012 3:31 pm
Subject: Re: How to ONLY sort part of a file and keep the format?

On Sep 13, 12:21 pm, Christian Brabandt <cbli...@256bit.org> wrote:

It also works using  \t  rather than the literal tab (^I):

:v/^\t/.,/^\t/-sort

Bill


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
William Fugh  
View profile  
 More options Sep 13 2012, 4:16 pm
From: William Fugh <viarm...@gmail.com>
Date: Fri, 14 Sep 2012 06:15:53 +1000
Local: Thurs, Sep 13 2012 4:15 pm
Subject: Re: How to ONLY sort part of a file and keep the format?

Amazing! thanks you guys very much! Got it.[?]
-------------
William

  360.gif
< 1K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bee  
View profile  
 More options Sep 13 2012, 7:15 pm
From: Bee <fo...@calcentral.com>
Date: Thu, 13 Sep 2012 16:15:22 -0700 (PDT)
Local: Thurs, Sep 13 2012 7:15 pm
Subject: Re: How to ONLY sort part of a file and keep the format?

> I think, this will do:
> :v/^^I/.,/^^I/-sort
> where ^I is a literal tab.

> It also works using  \t  rather than the literal tab (^I):
> :v/^\t/.,/^\t/-sort

Either way I get:
  E16: Invalid range

But the sort works!

Bill


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ping  
View profile  
 More options Sep 13 2012, 8:56 pm
From: ping <songpingem...@gmail.com>
Date: Thu, 13 Sep 2012 20:56:38 -0400
Local: Thurs, Sep 13 2012 8:56 pm
Subject: Re: [Help] How to ONLY sort part of a file and keep the format?
On 9/13/2012 3:21 PM, Christian Brabandt wrote:

interestingly, I tested it, this doesn't give the expected result.

//screen capture (that ^I is ctrl-v ctrl-i)
     1 for openers
     2 want out
     3 a load of old cobblers
     4 want for
     5         5. one
     6         6. two
     7         7. three
     8 muck about
     9 muck around
    10         20. one
    11         21. two
    12         22. three
    13 bottom on
    14         24. one
    15         25. two
    16         26. three
    17 lark around
    18 lark about
    19 darkred
    20         29. one
    21         30. two
    22         31. three
   ~
   ~
   ~
   ~
   ~
:v/^^I/.,/^^I/-sort

maybe we need that range-end (/^^I/) to be one line back?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
William Fugh  
View profile  
 More options Sep 14 2012, 12:03 am
From: William Fugh <viarm...@gmail.com>
Date: Fri, 14 Sep 2012 14:03:32 +1000
Local: Fri, Sep 14 2012 12:03 am
Subject: Re: How to ONLY sort part of a file and keep the format?

On Fri, Sep 14, 2012 at 9:15 AM, Bee <fo...@calcentral.com> wrote:
> > I think, this will do:
> > :v/^^I/.,/^^I/-sort
> > where ^I is a literal tab.

> > It also works using  \t  rather than the literal tab (^I):
> > :v/^\t/.,/^\t/-sort

> Either way I get:
>   E16: Invalid range

remove all empty lines. :-)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
William Fugh  
View profile  
 More options Sep 14 2012, 12:11 am
From: William Fugh <viarm...@gmail.com>
Date: Fri, 14 Sep 2012 14:11:20 +1000
Local: Fri, Sep 14 2012 12:11 am
Subject: Re: [Help] How to ONLY sort part of a file and keep the format?

try to press <TAB> key directly in command line. it does work fine. :-)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christian Brabandt  
View profile  
 More options Sep 14 2012, 2:54 am
From: "Christian Brabandt" <cbli...@256bit.org>
Date: Fri, 14 Sep 2012 08:54:14 +0200
Local: Fri, Sep 14 2012 2:54 am
Subject: Re: How to ONLY sort part of a file and keep the format?

On Fri, September 14, 2012 01:15, Bee wrote:
>> I think, this will do:
>> :v/^^I/.,/^^I/-sort
>> where ^I is a literal tab.

>> It also works using  \t  rather than the literal tab (^I):
>> :v/^\t/.,/^\t/-sort

> Either way I get:
>   E16: Invalid range

> But the sort works!

Was there possibly a trailing empty line?

regards,
Christian


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christian Brabandt  
View profile  
 More options Sep 14 2012, 2:58 am
From: "Christian Brabandt" <cbli...@256bit.org>
Date: Fri, 14 Sep 2012 08:58:15 +0200
Local: Fri, Sep 14 2012 2:58 am
Subject: Re: [Help] How to ONLY sort part of a file and keep the format?

I can't reproduce it and it works for me.

BTW: the range .,/^\t/- already backs up one line, see :h :range

regards,
Christian


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »