标题: [文本处理] pcregrep (v8.10 2010-06-25) - win 换行 [打印本页]
作者: tmplinshi 时间: 2013-5-19 11:15 标题: pcregrep (v8.10 2010-06-25) - win 换行
之前测试了几个 grep.exe,输出的换行都只有换行符而没有回车符。
pcregrep - a grep with Perl-compatible regular expressions.
Usage: pcregrep [OPTION]... [PATTERN] [FILE1 FILE2 ...]
Search for PATTERN in each FILE or standard input.
PATTERN must be present if neither -e nor -f is used.
"-" can be used as a file name to mean STDIN.
All files are read as plain files, without any interpretation.
Example: pcregrep -i 'hello.*world' menu.h main.c
Options:
-- terminate options
--help display this help and exit
-A, --after-context=number set number of following context lines
-B, --before-context=number set number of prior context lines
--buffer-size=number set processing buffer size parameter
--color=option matched text color option
--colour=option matched text colour option
-C, --context=number set number of context lines, before & after
-c, --count print only a count of matching lines per FILE
-D, --devices=action how to handle devices, FIFOs, and sockets
-d, --directories=action how to handle directories
-e, --regex(p)=pattern specify pattern (may be used more than once)
-F, --fixed-strings patterns are sets of newline-separated strings
-f, --file=path read patterns from file
--file-offsets output file offsets, not text
-H, --with-filename force the prefixing filename on output
-h, --no-filename suppress the prefixing filename on output
-i, --ignore-case ignore case distinctions
--no-jit ignored: this pcregrep does not support JIT
-l, --files-with-matches print only FILE names containing matches
-L, --files-without-match print only FILE names not containing matches
--label=name set name for standard input
--line-buffered use line buffering
--line-offsets output line numbers and offsets, not text
--locale=locale use the named locale
--match-limit=number set PCRE match limit option
--recursion-limit=number set PCRE match recursion limit option
-M, --multiline run in multiline mode
-N, --newline=type set newline type (CR, LF, CRLF, ANYCRLF or ANY)
-n, --line-number print line number with output lines
-o, --only-matching=n show only the part of the line that matched
-q, --quiet suppress output, just set return code
-r, --recursive recursively scan sub-directories
--exclude=pattern exclude matching files when recursing
--include=pattern include matching files when recursing
--exclude-dir=pattern exclude matching directories when recursing
--include-dir=pattern include matching directories when recursing
-s, --no-messages suppress error messages
-u, --utf-8 use UTF-8 mode
-V, --version print version information and exit
-v, --invert-match select non-matching lines
-w, --word-regex(p) force patterns to match only as words
-x, --line-regex(p) force patterns to match only whole lines
Numbers may be followed by K or M, e.g. --buffer-size=100K.
The default value for --buffer-size is 20480.
When reading patterns from a file instead of using a command line option,
trailing white space is removed and blank lines are ignored.
There is a maximum of 100 patterns, each of maximum size 8192 bytes.
With no FILEs, read standard input. If fewer than two FILEs given, assume -h.
Exit status is 0 if any matches, 1 if no matches, and 2 if trouble.
----------------------------------------
http://code.google.com/p/cppstor ... 32/bin/pcregrep.exe
http://code.google.com/p/srgb/downloads/detail?name=pcre8.20.7z
----------------------------------------
http://pan.baidu.com/share/link?shareid=238863362&uk=1124163200
作者: flaven 时间: 2013-7-5 08:40
很不错,谢谢!win下还是用这个比较保险
作者: CrLf 时间: 2013-7-6 20:38
体积好小,这两周刚好在用 pcre,静态库哪怕精简后再参加编译也要占掉一百多 KB 的体积,若未精简需要将近 200 KB,不知道这个 pcregrep 的库是不是经过优化
作者: PowerShell 时间: 2013-7-6 20:57
我来凑个热闹
powershell官方手册2.0
主题
about_Escape_Characters
中说到:
以下为 Windows PowerShell 能够识别(并输入)的特殊字符:
0 Null
`a 警报
`b 退格
`f 换页
`n 换行
`r 回车
`t 水平制表
`v 垂直制表
作者: Demon 时间: 2013-7-6 21:00
体积好小,这两周刚好在用 pcre,静态库哪怕精简后再参加编译也要占掉一百多 KB 的体积,若未精简需要将近 ...
CrLf 发表于 2013-7-6 20:38
pcre怎么在win下编译?
作者: CrLf 时间: 2013-7-6 21:03
回复 5# Demon
兄台博客里不是就有 tcc 编译 pcre 的办法吗~
作者: CrLf 时间: 2013-7-6 21:07
回复 4# PowerShell
任意控制台程序都支持 Ctrl+@~_ 对应 32 个控制字符,Alt+asc 对应当前代码页下任意字符,AHK 和 AU3(其实算是一回事)还支持各种特殊按键比如鼠标肿么破
作者: Demon 时间: 2013-7-6 21:17
回复 Demon
兄台博客里不是就有 tcc 编译 pcre 的办法吗~
CrLf 发表于 2013-7-6 21:03
老了,记性不好。
作者: qiwei201 时间: 2014-5-26 16:50
好久没来论坛了,今天无意跑到这看到这个帖子了,正好把我去年编译的单文件pcregrep 8.33发上来,用cmake编译还是挺方便的:- cd /d %TEMP%&&md PCRE&cd PCRE
- call "%ProgramFiles%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86
- rem 添加zlib支持
- set include=F:\Users\Builds\VC2012Build\include\;%include%
- set lib=F:\Users\Builds\VC2012Build\lib\;%lib%
- cmake -G "Visual Studio 11" -DPCRE_STATIC=1 f:\Users\Builds\pcre-8.33\
复制代码
http://pan.baidu.com/s/1q2EXg
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |