Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install / enable pcregrep on Cygwin?

I'm trying to use pcregrep as specified in the top answer to this SO question on Cygwin. My environment is Win7 64bit running Cygwin V 1.7.20(0.266/5/3).

Using cygcheck -p pcregrep I get:

Found 6 matches for pcregrep
libpcre-devel-8.37-1 - libpcre-devel: Perl Compatible Regular Expressions library development (installed binaries and support files)
libpcre-devel-8.37-2 - libpcre-devel: Perl Compatible Regular Expressions library development (installed binaries and support files)
pcre-debuginfo-8.37-1 - pcre-debuginfo: Debug info for pcre (installed binaries and support files)
pcre-debuginfo-8.37-2 - pcre-debuginfo: Debug info for pcre (installed binaries and support files)
pcre-8.37-1 - pcre: Perl Compatible Regular Expressions utilities (installed binaries and support files)
pcre-8.37-2 - pcre: Perl Compatible Regular Expressions utilities (installed binaries and support files)

I've tried using the instructions for installing pcregrep found in this tutorial, but patch doesn't seem to be part of the cygwin install. This tutorial was found through these two SO questions along the same lines as mine: SO Question 1 and SO Question 2, citing them so they show up in the related questions section. This man page shows that it can exist in cygwin, but trying to run the man page for it results in:

$ man pcregrep
No manual entry for pcregrep

It appears that the libraries for pcregrep exist in my cygwin install, but I don't know how to compile / extract / enable them to gain access to the utility. When I try to run it, I get the standard command not found response from bash:

$ pcregrep
-bash: pcregrep: command not found

So my question is: What do I do in cygwin to allow me to use pcregrep?

I'm not sure how to proceed, I've got tens of thousands of log files to process and I need to be able to find three lines that are related to each by the number of lines in between two of them, the makeup of the strings in those lines and a "header" line above them that tells me that the correct sensor type information follows (there can be multiple sensor data in a single log and I have to use a specific set of sensor data). If I can't figure out how to install pcregrep (which seems perfectly suited for the job), I'll ask the underlying question with data.

like image 438
delliottg Avatar asked Oct 29 '15 15:10

delliottg


1 Answers

Your cygcheck -p query indicates that pcregrep is mentioned in those three packages. The online package browser confirms that a pcregrep.exe binary is available in the pcre package: you don't have to compile anything.

Use the Cygwin installer, setup-x86.exe (for a 32-bit Cygwin) or setup-x86_64.exe (for a 64-bit Cygwin), which you've probably used to install Cygwin in the first place, to install the package: when you get to the "Select Packages" step, find pcre in the Text category, click the cycle icon in the New column until a version number appears, and finish the installation. If you no longer have the installer, you can download it from https://cygwin.com/.

like image 159
MvanGeest Avatar answered Nov 06 '22 16:11

MvanGeest