|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
I'm trying to search php files in a directory for their include files except those that have the strings "header" or "footer".
This is what I'm using so far with no luck: grep -Ers '((include|require)_once|include|include_files).*[^(footer|header)].*' directory_name I guess my question is how do I use the ^ to do a no match on strings. I can't seem to find the right documentation or examples anywhere. I'm using GNU grep version 2.4.2...Please help. Thanks. |
|
#2
|
|||
|
|||
|
I would do it in two steps:
1. find all includes 2. remove the headers and footers. Code:
grep -Eir . 'include(_files)?|require(_once)?' | grep -viE 'header|footer' ... adjust to your needs ![]() ("grep -v" is find "not") hth, M.
__________________
-- Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more. |
|
#3
|
|||
|
|||
|
aahhhh
brilliant. thanks!
|
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > using grep to find and not find strings |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|