|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | Albums | FAQ | Users | 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. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
finding first >
I want to erase some php code between a <? and a ?> in HTML containing a keyword, the problem is it finds the last > and wipes out everything before it how do i specify for it to stop searching after the first >? Code:
perl -i -p0e 's/<\?php.*keyword.*\?>//s' there's many lines of php code in the document so what this does is erases until the last > but i dont want it to go that far thanks! |
| Sponsored Links | |
|
|
|
#2
|
||||
|
||||
|
Code:
perl -i -p0e 's/<\?php.*?keyword.*?\?>//s' It is called "non-greedy" matching. |
| Sponsored Links | ||
|
|
|
#3
|
|||
|
|||
|
thanks for the quick response!
|
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Finding my DNS | jjinno | UNIX for Dummies Questions & Answers | 2 | 07-17-2007 09:14 AM |
| finding duplicate files by size and finding pattern matching and its count | jerome Sukumar | Shell Programming and Scripting | 2 | 12-01-2006 03:20 AM |
| Help finding a BOS | zuessh | AIX | 1 | 07-25-2006 02:48 AM |
| Finding last row | indo1144 | UNIX for Advanced & Expert Users | 7 | 09-23-2005 03:25 AM |
| Finding how done IT | geoquest | UNIX for Dummies Questions & Answers | 5 | 08-26-2002 10:12 AM |
|
|