How do I use pcre

New to Fedora, (just installed it) and a slow learner.
try to install pcre with dnf
“Package pcre2-10.42-1.fc39.2.x86_64 is already installed.”
issue terminal command “which pcre2”
/usr/bin/which: no pcre2 in (/root/.local/bin:/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/var/lib/snapd/snap/bin)

Somewhat confusing. What am I doing wrong?

pcre2 is a library, not an executable, so there’s nothing for which to find. What is your ultimate goal here?

Oh, a library. See. Slow learner.

I have pcregrep on all my Debian computers, and use it instead of grep. I have an alias pgr=‘/usr/bin/pcregrep’ because I am lazy.

I was hoping to do something similar on my Fedora distro. Can I?

dnf provides '*/pcregrep' shows that that’s in the pcre-tools package.

Also, you can enable Perl-compatible regular expressions (PCREs) for grep with -P option. You can use it without needing to install additional packages:

alias pgr='grep -P'
1 Like

Thank you Chris Williams. Somehow I thought pcre2 provided pcre-tools, but no.

Funny thing is, the Discover application manager shows no results for pcre anything. Not the best interface, IMHO.

Thank you ersen. Did not know that part about grep. Shows I read more science fiction than man pages.

Now, how do I mark this solved?

1 Like

Underneath every answer you find the symbols below. With the first one you mark an answer as solved.

Apparently you were logged in as root when you ran that command. The directories /root/.local/bin and /root/bin should never be seen in any commands when running as your regular user.

For security and to prevent damage to the system by inadvertent commands please log out of the root environment and use sudo for your admin tasks and your regular user for day to day use.