The UNIX and Linux Forums
>
Top Forums
>
Shell Programming and Scripting
Perl onliner to search the last line with an occurence of a pattern
User Name
Remember Me?
Password
Google UNIX.COM
Forums
Directory
Register
Forum Rules
FAQ
Contribute
Members List
Search
Today's Posts
Mark Forums Read
Thread
:
Perl onliner to search the last line with an occurence of a pattern
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
#
3
(
permalink
)
01-30-2008
KevinADC
Registered User
Join Date: Jan 2008
Posts: 338
another suggestion:
Code:
perl
-ne '@t = grep{/^cool/}<>; print $t[-1]; exit' path/to/inputfile
change single quotes to double-quotes if using Windows
Last edited by KevinADC; 01-30-2008 at
05:44 PM
.. Reason: had to add "exit"
KevinADC
View Public Profile
Find all posts by KevinADC