Tim Allen on 3 Aug 2015 07:00:01 -0700 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: [PLUG] xargs guide |
The manpage for GNU's grep says fgrep is deprecated:
In addition, the variant programs egrep, fgrep and rgrep are the
same as grep -E, grep -F, and grep -r, respectively. These variants
are deprecated, but are provided for backward compatibility.
I'm not seeing a noticeable difference in speed using -F in my limited
testing -- searching for "nan" in 75MB of JSON spread over 25 files --
but it seems like a good idea and I'll try to remember to use it in
the future.
On Thu, Jul 30, 2015 at 04:07:39PM -0400, Tim Allen wrote:
> 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
___________________________________________________________________________
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