![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Perl Search and replace entire line | insania | Shell Programming and Scripting | 1 | 05-22-2008 03:45 PM |
| Multile Pattern Search in a same line and delete | sasree76 | Shell Programming and Scripting | 2 | 04-16-2008 11:12 AM |
| Perl: Search for string on line then search and replace text | Crypto | Shell Programming and Scripting | 4 | 01-04-2008 06:24 AM |
| Perl: Search for string then parse next line | pondlife | Shell Programming and Scripting | 4 | 04-06-2006 01:44 AM |
| Pattern occurence in a file | videsh77 | UNIX for Dummies Questions & Answers | 5 | 12-10-2004 03:41 AM |
|
|
Submit Tools | LinkBack | Thread Tools | 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 |
| Forum Sponsor | ||
|
|
|
||||
|
Hi.
Similar discussion at Need a script to remove last comma in a file - LinuxQuestions.org ... cheers, drl |