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 6731487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:32:06+00:00 2026-05-26T10:32:06+00:00

This is some lines of text in a file. I need to remove certain

  • 0

This is some lines of text in a file. I need to remove certain block of text using vi editor.

An aurora (plural: auroras or aurorae) is a natural light display in the sky particularly in the high latitude (Arctic and Antarctic) regions, caused by the collision of energetic charged particles with atoms in the high altitude atmosphere (thermosphere).

Most aurorae occur in a band known as the auroral zone[2][2] which is typically 3° to 6° in latitudinal extent and at all local times or longitudes.

The auroral zone is typically 10° to 20° from the magnetic pole defined by the axis of the Earth's magnetic dipole. During a geomagnetic storm, the auroral zone will expand to lower latitudes. The diffuse aurora is a featureless glow in the sky which may not be visible to the naked eye even on a dark night and defines the extent of the auroral zone.

I have a input file like above. In this file I have to remove certain occurrences of a block of text like the following.

Most aurorae occur in a band known as the auroral zone[2][2] which is typically 3° to 6° in latitudinal extent and at all local times or longitudes.

So, I am using following command which is not working :

:g/^Most/,/auroral/,/longitudes./d

I am deleting the lines starting with Most , auroral in the mid and longitudes at the end.

  • 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-26T10:32:06+00:00Added an answer on May 26, 2026 at 10:32 am

    There are distinct limits on what you can do, but in the context, you could use:

    :g/^while/.,/^}/d
    

    to delete a while loop where the while is at the start of a line up to the close brace at the start of a line.


    Can you please add some more to this?

    The :g/^while/ part searches globally for lines that start with while. What follows is an ex command that is executed for each matched line. The command is .,/^}/d, which means from the current line (.) to the next line starting with close brace (/^}/) do a delete (d). You can use things like backward searches or relative motions (?^{? or .-3 or .+10) as well.

    It is difficult to tell from the mangled appearance of the comment exactly what you have in mind (not your fault – comments don’t preserve useful formatting.)

    --------------
    Stack Over Flow
    c**p
    c**p
    c**p
    cool
    c**p
    c**p
    c**p
    ------------
    

    I need to replace from Stack Over Flow to ------------ […]

    That is simple, and I don’t see how the cool has any effect on it:

    :g/^Stack Over Flow/.,/^-------/d
    

    This is isomorphic with my original answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a plain text file looking like this: some text containing line breaks
Every day we get a flat text file. Some days there are lines in
I have a file that I need to reformat and remove extra blank lines.
I need to get the line number of a text file using PHP. The
I'm having difficulty combining some lines in a comma delimited text file if the
I have a text file. Some of the lines in it end with lf
I have to filter a text file filter.tmp containing two types of lines, this
I try to draw some lines with different colors. This code tries to draw
Anybody please give some useful links on this topic.i need to create a content
I need to strip the last line from a text file. I know how

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.