Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8638961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:52:35+00:00 2026-06-12T10:52:35+00:00

I need to sort and diff a few lists that have 1,000s of entries

  • 0

I need to sort and diff a few lists that have 1,000s of entries on them. The lists looks like:

11-2-3049_2007_squib.pdf
11-11-5476_2004_squib.pdf
13-2-5477_2006_squib.pdf
14-3-3045A_2004_squib.pdf
14-CMF-3046_2004_squib.pdf
14-2-3047_2005_squib.pdf
14-4-3048_2004_squib.pdf
15-7-3050P_2004_squib.pdf

I’m looking to sort by the number between the second - and before the _, such as 3049 in the first example.

I’ve not been able to combine the sort by column and regex stuff with any success. What do you all suggest?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T10:52:36+00:00Added an answer on June 12, 2026 at 10:52 am

    This should do the trick:

    :sort r  /\v^(.{-}-){2}\zs.{-}\ze_/
    

    See

    :help sort
    

    for background here

    The regex contains a few twists and turns:

    • \v to engage very magic mode (reducing the need for escaping)
    • \zs and \ze to mark the begin and end of the actual match result
    • {-} to perform non-greedy kleene-star match (in Perl notation, .{-} would be .*?)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to sort an array that can look like this: $array[4][0] = array('id'
I need to sort filenames that can have a common root, but are then
I have many large (>35,000,000) lists of integers that will contain duplicates. I need
I need to sort nodes in xml. I have the following code which successfully
I need to sort close to a 1,00,000 floating point entries in Delphi. I
I need to sort then print the result increasing and decreasing. I have some
I have a custom sort routine that works great, but I was curious about
I need some sort of node-graph editor, that hopefully works on both Mac and
I need a sort of live effect on some checkbox - I need that
I need to sort some products base on user ratings. Suppose we have 3

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.