zsh-workers
 help / color / mirror / code / Atom feed
8b1edaa1ce12740cec6bf0660856d10106ade2dc blob 377 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 
# Usage: zpgrep <perl5-compatible regex> <file1> <file2> ... <fileN>
#

zpgrep() {
local file pattern

pattern=$1
shift

if ((! ARGC)) then
	set -- -
fi

pcre_compile $pattern
pcre_study

for file
do
	if [[ "$file" == - ]] then
		while read -u0 buf; do pcre_match $buf && print $buf; done
	else
		while read -u0 buf; do pcre_match $buf && print $buf; done < "$file"
	fi
done
}
debug log:

solving 8b1edaa1c ...
found 8b1edaa1c in https://git.vuxu.org/mirror/zsh/

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).