Re: SOLVED - Re: follow-up: searching a directory sub-tree.

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

 



home user via users wrote:
> On 3/26/25 8:02 PM, home user via users wrote:
>> On 3/26/25 7:40 PM, Sam Varshavchik wrote:
>>> home user via users writes:
>
>> By the way, grep's behavior suggests that the order of
>> the options matters.  I did not expect that.  Does the
>> order of the options really matter?
>
> I was paying attention to the options part (and below) of
> the man page, not the top part that showed syntax.  The
> syntax does suggest, and my testing shows, that the 'e'
> option must be the last, and must immediately precede the
> search string.

I think the man page clearly indicates that the -e option
requires an argument:

   Matching Control
       -e PATTERNS, --regexp=PATTERNS
              Use PATTERNS as the patterns.  If this option is used
              multiple times or is combined with the -f (--file) option,
              search for all patterns given.  This option can be used to
              protect a pattern beginning with “-”.

It may be specified multiple times, each of which requires
an argument, e.g.:

    grep -e foo -e bar /path/to/baz

If you're trying to write a generic wrapper around grep, I
don't think you'll end up with something that is much (if
any) easier to use than grep.  To do so, you'll have to
learn the grep syntax well enough that you might as well
just call grep. :)

Rather, if you have some common use case (or a few), write
one or more scripts which work for just those cases and
properly handles the arguments needed (including rejecting
bogus uses if they can be determined from the arguments
given).

In the end, the time spent writing those wrappers is likely
to be more than the time spent reading and remembering the
grep command syntax.

-- 
Todd

Attachment: signature.asc
Description: PGP signature

-- 
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux