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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:15:04+00:00 2026-06-15T05:15:04+00:00

here is the input: aaa bbb ccc ddd eee fff what I want? do

  • 0

here is the input:

aaa
bbb
ccc
ddd
eee
fff

what I want? do sth like” sed “/ccc/,/(eee)/d” BUT ALSO DELETE “bbb” line (before “ccc”)
so that output is:

aaa
fff

any ideas?

  • 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-15T05:15:05+00:00Added an answer on June 15, 2026 at 5:15 am

    If you are fine with awk, this should do:

    $ awk '/ccc/,/eee/{if(i!=1){i=1;x="";}next}{if (x)print x;x=$0;}END{print x}' file
    aaa
    fff
    

    Every previous line is printed in the above case. Normal range filtering is done using awk. However, within the range filter, the variable x is reset so that the previous record just before the range is not printed.

    Update:

    sed solution:

    $ sed '${x;p;};/ccc/,/eee/{/ccc/{s/.*//;x;};d;};1{h;d;};x;/^$/d;' file
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<table> <tr><td>aaa</td><td><input type=checkbox name=yes[] value=aaa checked /></td></tr> <tr><td>bbb</td><td><input type=checkbox name=yes[] value=bbb /></td></tr> <tr><td>ccc</td><td><input type=checkbox
Here's the situation: I would like to iterate through a table with input controls,
<form action=here.php method=POST> <input type=text name=text> <div id=one> <input type=hidden name=aaa value=one> <input type=submit
<input type=text value=Here id=aaa> <br /> <span id=check>check</span> $('#check').click(function(){ alert($('input [value=Here]').attr('id')); }) http://jsfiddle.net/mHYsJ/ why
So far I have the following var aCleanData = ['aaa','aab','faa','fff','ffb','fgh','mmm','maa']; $('#my-input').autocomplete({ source:aCleanData, minLength:2 });
I have a view that dynamically updates depending on user input - here's how
here is the input data: % @param Landmarks: % Landmarks should be 1*m struct.
Here is the input form code <tr valign=top> <td align=right class=innertablestyle><font class=normal><strong>Homepage</strong></font></td> <td>&nbsp;</td> <td>
Here's my code: sentenceToTranslate = raw_input(Please write in the sentence you want to translate:
Here is my jquery code: $('input').click(function(){ $('h1').empty().queue(function(){ console.log('queue'); }); }); }); Only the first

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.