The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



Thread: sed help
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 02-01-2008
ammu ammu is offline
Registered User
 

Join Date: Jul 2006
Posts: 62
sed help

Hi,

I have a file and i have to insert a line above a particular line in the file.
In the file the lines starts with dates and can have lines starting with repeated dates. I want to search(first occurence) for a line starting with particular date and insert a line above that line
Ex
sample.txt
-------------------------------
013008 .......
013008 .......
013108 .......
013108 .......
013008 .......
020108
020108 ........

Say i want to search for a line starting with 020108(first occurence ) and insert a line above it. Can you please give me the sed command for that
or perl onliner.

Thanks in advance
ammuu

Last edited by ammu; 02-01-2008 at 08:48 AM..
Reply With Quote
Remove advertisements
!!
Forum Sponsor