On Tue, 2010-06-15 at 17:37 -0400, Adam wrote:
> This is one of those things where I know there must be several dozen
> ways to do it, but I can't seem to think of any of them! What I'd like
> to do is to get all the text from text file "file" starting with the
> line containing the LAST occurrence of "string", through the last line
> of "file", and all this will be piped to another program. Anybody have
> any ideas? Thanks!
tail -n $(expr $(wc -l file | sed -e 's/^\([0-9]\+\) .*/\1/') - $(grep -nho
"string" file | tail -n1 | sed -e 's/\([0-9]\+\):.*/\1/') + 1) file
Seemed to work.
-Renier
_______________________________________________
Mid-Hudson Valley Linux Users Group http://mhvlug.org
http://mhvlug.org/cgi-bin/mailman/listinfo/mhvlug
Upcoming Meetings (6pm - 8pm) MHVLS Auditorium
Jul 7 - Patent Absurdity - The Movie
Aug 4 - Samba
Sep 1 - BOINC