The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 08-28-2007
LaLonde LaLonde is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 4
Is sed the answer?

Hey, I am very new to scripting and could use a bit of help.

I have a situation where I have an ascii file and I want to delete all lines beneath a particular string.

EXAMPLE:

The contents of a file named example.txt looks like the following:

JANUARY
FEBRUARY
MARCH
APRIL
MAY
JUNE
JULY
AUGUST
SEPTEMBER
OCTOBER
NOVEMBER
DECEMBER


Now I want to be able to run a command where it will delete all lines in the example.txt file beneath the "JUNE" line. I assume that this is pretty easy to do, but given my lack of experience I am having trouble figuring this out.

Is sed the answer? If so, what would the exact command be given my example?

The system I will run the command on is a Solaris 10 base install system with no 3rd-party packages installed.

Thank you in advance!

- LaLonde