![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| Perl Search and replace entire line | insania | Shell Programming and Scripting | 1 | 05-22-2008 06:45 PM |
| Multile Pattern Search in a same line and delete | sasree76 | Shell Programming and Scripting | 2 | 04-16-2008 02:12 PM |
| Perl: Search for string on line then search and replace text | Crypto | Shell Programming and Scripting | 4 | 01-04-2008 10:24 AM |
| Perl: Search for string then parse next line | pondlife | Shell Programming and Scripting | 4 | 04-06-2006 04:44 AM |
| Pattern occurence in a file | videsh77 | UNIX for Dummies Questions & Answers | 5 | 12-10-2004 07:41 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Perl onliner to search the last line with an occurence of a pattern
Hi
I need a perl onliner which seaches a line starting with a pattern(last occurence) and display it. similar to grep 'pattern' filename | tail -1 in UNIX Ex: I want to display the line starting with "cool" and which is a last occurence adadfadafadf adfadadf cool dfadfadfadfara adfadfadf cool aaaaaaaaaaaaaa hai how are you It should dispaly the line which is red. I need it in perl one line command I am not sure how i should do. I have an idea that we can do it with perl -ne 'print ......... Your help will be highly appreciated Thanks Ammu |
|
|||||
|
Hi.
Similar discussion at Need a script to remove last comma in a file - LinuxQuestions.org ... cheers, drl |
|
||||
|
In the above example i would like to add another line after the red line(last occurence of line starting with cool).How can i do that with a perl onliner
Thanks in advance Lijju |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|