tag 34126 notabug thanks On 1/18/19 2:27 PM, Ricky Tigg wrote: > OS: *Fedora*; Component: grep.x86_64 3.1-8.fc29 > > Commands executed: > > $ dnf list|grep -Ei langpack | grep fi. > glibc-langpack-fi.x86_64 2.28-26.fc29 @updates > langpacks-fi.noarch 1.0-13.fc29 @System > (...) > > $ dnf list|grep -Ei langpack | grep fi. | grep "-fi." > grep: i.: No such file or directory > > Using grep twice in the same command, the command's last grep is expected > to produce targets, not an STDERR. Probably an issue.
Not an issue in grep, but in your attempt to use a pattern beginning with - in a way that grep cannot distinguish from options. That is, you asked grep to use the -f option, which takes an argument, so it used "i." as the argument for -f, and failed because there is no file named 'i.' in your current directory. (That's true whether you write -fi. or "-fi.", because the shell strips quoting before grep sees its argv[]). You want to use either of these formulations instead: grep -e -fi. grep -- -fi. where the "-e" option says to treat the next argv[] entry as a pattern, even if it otherwise would look like an option, and then continue finding further options; while the "--" argument says that no more options are present, and that all further command line arguments are treated according to their traditional positional usage). The difference becomes apparent in constructs like: grep -e -fi. -i # greps stdin case-insensitively for "-fi." grep -- -fi. -i # greps file ./-i case-sensitively for "-fi." -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature