How to install / enable pcregrep on Cygwin?

时间:2015-10-29 15:51:18

标签: cygwin pcregrep

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.

1 个答案:

答案 0 :(得分:3)

您的cygcheck -p查询表明这三个包中提到了pcregreponline package browser确认pcregrep.exe包中有pcre 二进制:您无需编译任何内容。

使用Cygwin安装程序,setup-x86.exe(对于32位Cygwin)或setup-x86_64.exe(对于64位Cygwin),您可能已经习惯于首先安装Cygwin,安装软件包:当您进入“选择软件包”步骤时,在文本类别中找到pcre,单击“新建”列中的循环图标,直到出现版本号,然后完成安装。如果您不再拥有安装程序,可以从https://cygwin.com/下载。