The UNIX and Linux Forums  

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



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Removing the first and last lines in a file naveendronavall AIX 1 12-29-2007 11:44 PM
Removing lines from a file computersaysno UNIX for Dummies Questions & Answers 6 11-14-2006 06:50 PM
Removing lines within a file tookers Shell Programming and Scripting 3 08-22-2006 10:49 AM
Removing lines from a file PradeepRed Shell Programming and Scripting 4 12-17-2005 06:34 AM
Removing lines in a text file. WABonnett Shell Programming and Scripting 4 11-25-2003 11:27 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 12-29-2007
naveendronavall naveendronavall is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 3
Post Removing the first and last lines in a file

Hi Gurus,

I'm a little new to UNIX. How can I do remove the first and last line in a file? Say, supppose I have a file as below:
Code:
Code:
1DMA                 
400002BARRIE         
401002CALGARY/LETHBRI
402002CARLETON       
500001PORTLAND-AUBRN 
501001NEW YORK, NY   
502001BINGHAMTON, NY 
9DMA     255
I want to remove the line 1 and line 8 ( one which starts with '1DMA' meaning it is a header and the trailer which starts with '9DMA'). My final result should be as below:


Code:
Code:
400002BARRIE         
401002CALGARY/LETHBRI
402002CARLETON       
500001PORTLAND-AUBRN 
501001NEW YORK, NY   
502001BINGHAMTON, NY
Your help and inputs are greatly appreciated!

Many thanks,
Naveen.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:47 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0