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
signature.asc
Description: PGP signature
-- _______________________________________________ users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-le...@lists.fedoraproject.org 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@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue