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

  • Home
  • SEARCH
  • 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 6962181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:37:35+00:00 2026-05-27T15:37:35+00:00

A text file is formatted like this: Section 4 Area B Unit 20 stuff

  • 0

A text file is formatted like this:

Section 4 Area B Unit 20
   stuff i don't need...
   stuff i don't need...
   45990 - Title of Project that I want to save
   line of text I need to keep
   line of text I need to keep
   2010-11 this line (starting with 2010) is not needed
   stuff i don't need

Section 589 Area C Unit 1005
   stuff i don't need...
   stuff i don't need...
   45990 - Title of Project that I want to save
   line of text I need to keep
   line of text I need to keep
   2010-11 this line (starting with 2010) is not needed
   stuff i don't need

and these sections repeat by the hundreds. The “stuff i don’t need” lines are actually about 30 or so. I need to keep the association of the “Section…” line, “Title…” line and “line of text I need to keep” related to each other. So I was hoping to first destruct the text document down (linewise) to the stuff I need before operating on it further (character-wise). So I wrote this:

g!/\Section\s\d*\sArea\s\h\sUnit\s\d*\n\|^\s\{3}\zs\d*\s-\_.*\ze2010-11/d

After deleting I get the “Section..” line and the “Title…” line, but never the subsequent lines underneath the “Title..” line. Those subsequent lines vary from 4 to 8 lines, but the “2010-11” line is consistent and always what I no longer want.

You can see I tried using zs and ze to select what I do not want deleted. I think the selection is working because if I change the command to “2011-12” then there is no match and the (OR) half of the command does not return a result.

I think the fault might be the cursor position(?), but I’m not sure and my effort to fix that has failed.

Can anyone see my error?

Thanks!

  • 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-05-27T15:37:36+00:00Added an answer on May 27, 2026 at 3:37 pm

    Give this a whirl.

    :silent! g/^Section/+ , /^\s\+\d\+ -/- d
    :g/^\s\+2010/ , -/\nSection\|\%$/ d
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text file with hundreds of entries formatted like this, I need
I have a text file, that is formatted somewhat like this: 1 3 4
In a text file, there is a string I don't like this. However, when
Say I have a text file formatted like this: 100 20 the birds are
I have a YAML formatted text file, and would like to define custom folding
I’m writing to a text file and it looks like this... 19/05/2010 15:33:34 Verbose
I have an XML file formatted like <paragraph> Some Free text goes here<LinkType1 href=link1
I have a CSV file, formatted like this: 0001 @ word @ some information
Let's say I have a binary file that is formatted like [unsigned int(length of
I have a text file of e-mails like this: 10:info@example.com;dev@example.com 12:john@host.com; George <g.top@host.com> 43:jim.p@web.com.;sue-allen@web.com

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.