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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Quick question on grep: grabbing lines above and below thecoffeeguy Shell Programming and Scripting 3 05-29-2008 12:30 AM
Need to serach if a new line character exists on the last line in a file sunilbm78 UNIX for Dummies Questions & Answers 10 02-29-2008 10:15 AM
script grabbing cvs file ..... llsmr777 Shell Programming and Scripting 4 11-15-2007 11:16 AM
Appending the line number and a seperator to each line of a file ? pjcwhite Shell Programming and Scripting 4 03-20-2007 09:29 PM
Grabbing lines out of a file based on a date bsp18974 Shell Programming and Scripting 2 07-17-2006 05:58 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-24-2008
Registered User
 

Join Date: Dec 2006
Posts: 28
Stumble this Post!
Sed grabbing the last line of a file

I can grab the first line w/ sed how do you grab the last line of a file?
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 03-24-2008
in2nix4life's Avatar
Registered User
 

Join Date: Oct 2007
Location: East Coast
Posts: 44
Stumble this Post!
Hope this helps:

sed -n '$p'
Reply With Quote
  #3 (permalink)  
Old 03-24-2008
Registered User
 

Join Date: Sep 2006
Posts: 1,541
Stumble this Post!
Code:
tail -1 file
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 10:06 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0