1

I have written this code in Linux, How can I achieve the same in Windows server ?

find "dirname" -name "*.php" -exec grep -PHl "(eval\(.*\);)" {} \;

Basically I want to find out this pattern

eval(something here);

6
  • Please add some context to explain the code sections
    – Bilo
    Jul 28, 2015 at 7:14
  • to do clever regexes in windows, you use cygwin(a program you must install on windows if you are even a fraction of a linux geek) and do the linux commands, or there can often be ways to do things in powershell which is very powerful
    – barlop
    Jul 28, 2015 at 7:50
  • why say ""dirname"" it sounds like a filename particularly as you are saying *.php
    – barlop
    Jul 28, 2015 at 7:53
  • What does the 1 do in PH1?
    – barlop
    Jul 28, 2015 at 8:15
  • And your regex might be quite simple in which case cmd's 'find' can do it(with a for /f)..
    – barlop
    Jul 28, 2015 at 8:16

1 Answer 1

1

You could always using MinGW and MSys (or MSYS2) on Windows to do what you specified in the question, which come with find, grep and many other commonly used Unix commands.

1
  • MSys (or MSYS2) ==> This seems to be far better. As a Linux System admin, MSYS2 is a great tool to manage windows based server. I can mostly reuse my linux script to manage the Windows server. Thanks.
    – Mani
    Aug 3, 2015 at 7:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .