Summary: get the last line in a file that matches a pattern with sed

From: Zaigui Wang <zaigui_at_yahoo.com>
Date: Thu Jul 31 2003 - 16:52:33 EDT
The concensus seems to be just grep the patters from
the file and pipe it out to tail -1. I was hoping for
something fancier, but this will work...

Crist Clark also had this nice awk command:
awk '/<your date pattern>/{last=$0} END{print last}'

Thanks to:
rmck
Mark Scarborough
Frank Velazquez
David Foster
Crist Clark
Daniel Baldoni
Bochnik, William J
Janson.Santos@pinnaclewest.com
David.markowitz@sspsolutions.com
mike.salehi@kodak,com

Zaigui Wang wrote:
> 
> Managers,
> 
> I need to get the last line in a file that matches a
> date pattern (e.g. /03/07/03). How would I do that?
> 
> sed seems to be a good choice. I was able to get a
> paricular line from a file this way with sed: sed -n
> 16p file, but I am open to all solutions that work.
> 
> Any idea?


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Thu Jul 31 16:56:04 2003

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:17 EST