Tim Allen on 30 Jul 2015 13:07:50 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] xargs guide


If you're not doing pattern matching, it is a good habit to use:

    fgrep -rl --include="*.php" 'malware url on google malware report' /path/to/dirs/with/php_files

fgrep is exactly the same as grep -F. If you're doing a search on a deep directory path with lots of files, not having pattern matching can increase the speed significantly. It is a hard habit to break after years of grepping (I'm guilty as charged), but I'm getting better about it, as it is the exception that I'm doing any pattern matching in my greps rather than the rule.

Regards,

-Tim

On Thu, Jul 30, 2015 at 11:43 AM, <bergman@merctech.com> wrote:
In the message dated: Thu, 30 Jul 2015 00:28:51 -0400,
The pithy ruminations from Michael Lazin on
<Re: [PLUG] xargs guide> were:
=> I also use xargs, for example, to find a malware string in php code, like
=> "find . -name '*,php' | xargs grep 'malware url on google malware report' | cut -d: -f1"

Ick.

With a suitably modern version of grep:

        grep -rl --include="*,php" 'malware url on google malware report' /path/to/dirs/with/php_files

Mark

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug