Skip to content

Commit

Permalink
released 3.3.7 to fix #149
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-van-Engelen committed Aug 6, 2021
1 parent 8eac6e8 commit d190ac4
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 72 deletions.
61 changes: 31 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3059,9 +3059,9 @@ field | output
`%a` | the file basename without directory path
`%p` | the directory path to the file
`%z` | the pathname in a (compressed) archive, without `{` and `}`
`%H ` | if option `-H` is used: the quoted pathname and separator
`%[ARG]H` | if option `-H` is used: `ARG`, the quoted pathname and separator
`%h` | the quoted file pathname
`%H` | if option `-H` is used: the quoted pathname and separator, `\"` and `\\` replace `"` and `\`
`%[ARG]H` | if option `-H` is used: `ARG`, the quoted pathname and separator, `\"` and `\\` replace `"` and `\`
`%h` | the quoted file pathname, `\"` and `\\` replace `"` and `\`
`%N` | if option `-n` is used: the line number and separator
`%[ARG]N` | if option `-n` is used: `ARG`, the line number and separator
`%n` | the line number of the match
Expand Down Expand Up @@ -4455,9 +4455,10 @@ in markdown:
%z the file pathname in a (compressed) archive.

%[ARG]H
if option -H is used: ARG, the quoted pathname and separator.
if option -H is used: ARG, the quoted pathname and separator, \"
and \\ replace " and \.

%h the quoted file pathname.
%h the quoted file pathname, \" and \\ replace " and \.

%[ARG]N
if option -n is used: ARG, the line number and separator.
Expand Down Expand Up @@ -4539,7 +4540,7 @@ in markdown:

%u select unique lines only, unless option -u is used.

%1 the first regex group capture of the match, and so on up to
%1 the first regex group capture of the match, and so on up to
group %9, same as %[1]#; requires option -P.

%[NUM]#
Expand All @@ -4549,47 +4550,47 @@ in markdown:
the first group capture NUM that matched; requires option -P.

%[NAME]#
the NAMEd group capture; requires option -P and capturing pat-
the NAMEd group capture; requires option -P and capturing pat-
tern `(?<NAME>PATTERN)', see also %G.

%[NAME1|NAME2|...]#
the first NAMEd group capture that matched; requires option -P
the first NAMEd group capture that matched; requires option -P
and capturing pattern `(?<NAME>PATTERN)', see also %G.

%G list of group capture indices/names that matched; requires
%G list of group capture indices/names that matched; requires
option -P.

%[TEXT1|TEXT2|...]G
list of TEXT indexed by group capture indices that matched;
list of TEXT indexed by group capture indices that matched;
requires option -P.

%g the group capture index/name matched or 1; requires option -P.

%[TEXT1|TEXT2|...]g
the first TEXT indexed by the first group capture index that
the first TEXT indexed by the first group capture index that
matched; requires option -P.

%% the percentage sign.

Formatted output is written without a terminating newline, unless %~ or
`\n' is explicitly specified in the format string.

The [ARG] part of a field is optional and may be omitted. When
present, the argument must be placed in [] brackets, for example %[,]F
The [ARG] part of a field is optional and may be omitted. When
present, the argument must be placed in [] brackets, for example %[,]F
to output a comma, the pathname, and a separator.

%[SEP]$ and %u are switches and do not send anything to the output.

The separator used by the %F, %H, %N, %K, %B, %S and %G fields may be
The separator used by the %F, %H, %N, %K, %B, %S and %G fields may be
changed by preceding the field by %[SEP]$. When [SEP] is not provided,
this reverts the separator to the default separator or the separator
this reverts the separator to the default separator or the separator
specified with --separator.

Formatted output is written for each matching pattern, which means that
a line may be output multiple times when patterns match more than once
on the same line. If field %u is specified anywhere in a format
a line may be output multiple times when patterns match more than once
on the same line. If field %u is specified anywhere in a format
string, matching lines are output only once, unless option -u,
--ungroup is specified or when more than one line of input matched the
--ungroup is specified or when more than one line of input matched the
search pattern.

Additional formatting options:
Expand All @@ -4606,8 +4607,8 @@ in markdown:
--format-end=FORMAT
the FORMAT when ending the search.

The context options -A, -B, -C, -y, and display options --break,
--heading, --color, -T, and --null have no effect on formatted output.
The context options -A, -B, -C, -y, and display options --break,
--heading, --color, -T, and --null have no effect on formatted output.

EXAMPLES
Display lines containing the word `patricia' in `myfile.txt':
Expand Down Expand Up @@ -4668,7 +4669,7 @@ in markdown:

$ ugrep -n -f c++/comments myfile.cpp

List the lines that need fixing in a C/C++ source file by looking for
List the lines that need fixing in a C/C++ source file by looking for
the word `FIXME' while skipping any `FIXME' in quoted strings:

$ ugrep -e FIXME -N '"(\\.|\\\r?\n|[^\\\n"])*"' myfile.cpp
Expand Down Expand Up @@ -4698,7 +4699,7 @@ in markdown:

$ ugrep -z -tc++ -n FIXME project.tgz

Recursively find lines with `FIXME' in C/C++ files, but do not search
Recursively find lines with `FIXME' in C/C++ files, but do not search
any `bak' and `old' directories:

$ ugrep -n FIXME -tc++ -g^bak/,^old/
Expand All @@ -4708,9 +4709,9 @@ in markdown:

$ ugrep -z -w --filter='pdf:pdftotext % -' copyright

Match the binary pattern `A3hhhhA3hh' (hex) in a binary file without
Unicode pattern matching -U (which would otherwise match `\xaf' as a
Unicode character U+00A3 with UTF-8 byte sequence C2 A3) and display
Match the binary pattern `A3hhhhA3hh' (hex) in a binary file without
Unicode pattern matching -U (which would otherwise match `\xaf' as a
Unicode character U+00A3 with UTF-8 byte sequence C2 A3) and display
the results in hex with -X using `less -R' as a pager:

$ ugrep --pager -UXo '\xa3[\x00-\xff]{2}\xa3[\x00-\xff]' a.out
Expand All @@ -4723,12 +4724,12 @@ in markdown:

$ ugrep -l '' --ignore-files

List all files containing a RPM signature, located in the `rpm' direc-
List all files containing a RPM signature, located in the `rpm' direc-
tory and recursively below up to two levels deeper (3 levels total):

$ ugrep -3 -l -tRpm '' rpm/

Monitor the system log for bug reports and ungroup multiple matches on
Monitor the system log for bug reports and ungroup multiple matches on
a line:

$ tail -f /var/log/system.log | ugrep -u -i -w bug
Expand All @@ -4752,16 +4753,16 @@ in markdown:


LICENSE
ugrep is released under the BSD-3 license. All parts of the software
have reasonable copyright terms permitting free redistribution. This
ugrep is released under the BSD-3 license. All parts of the software
have reasonable copyright terms permitting free redistribution. This
includes the ability to reuse all or parts of the ugrep source tree.

SEE ALSO
grep(1).



ugrep 3.3.6 July 26, 2021 UGREP(1)
ugrep 3.3.7 August 06, 2021 UGREP(1)

🔝 [Back to table of contents](#toc)

Expand Down
Binary file modified bin/win32/ugrep.exe
Binary file not shown.
Binary file modified bin/win64/ugrep.exe
Binary file not shown.
5 changes: 3 additions & 2 deletions man.sh
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,10 @@ the directory path to the file.
.IP \fB%z\fR
the file pathname in a (compressed) archive.
.IP \fB%[\fR\fIARG\fR\fB]H\fR
if option \fB-H\fR is used: \fIARG\fR, the quoted pathname and separator.
if option \fB-H\fR is used: \fIARG\fR, the quoted pathname and separator, \\"
and \\\\ replace " and \\.
.IP \fB%h\fR
the quoted file pathname.
the quoted file pathname, \\" and \\\\ replace " and \\.
.IP \fB%[\fR\fIARG\fR\fB]N\fR
if option \fB-n\fR is used: \fIARG\fR, the line number and separator.
.IP \fB%n\fR
Expand Down
7 changes: 4 additions & 3 deletions man/ugrep.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH UGREP "1" "July 26, 2021" "ugrep 3.3.6" "User Commands"
.TH UGREP "1" "August 06, 2021" "ugrep 3.3.7" "User Commands"
.SH NAME
\fBugrep\fR, \fBug\fR -- file pattern searcher
.SH SYNOPSIS
Expand Down Expand Up @@ -937,9 +937,10 @@ the directory path to the file.
.IP \fB%z\fR
the file pathname in a (compressed) archive.
.IP \fB%[\fR\fIARG\fR\fB]H\fR
if option \fB-H\fR is used: \fIARG\fR, the quoted pathname and separator.
if option \fB-H\fR is used: \fIARG\fR, the quoted pathname and separator, \\"
and \\\\ replace " and \\.
.IP \fB%h\fR
the quoted file pathname.
the quoted file pathname, \\" and \\\\ replace " and \\.
.IP \fB%[\fR\fIARG\fR\fB]N\fR
if option \fB-n\fR is used: \fIARG\fR, the line number and separator.
.IP \fB%n\fR
Expand Down
8 changes: 4 additions & 4 deletions src/ugrep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5694,8 +5694,8 @@ void terminal()
dupenv_s(&env_grep_colors, "GREP_COLORS");
const char *grep_colors = env_grep_colors;

// if GREP_COLOR is defined, use it to set mt= default value (overridden by GREP_COLORS mt=, ms=, mc=)
if (env_grep_color != NULL)
// if GREP_COLOR is defined but not GREP_COLORS, use it to set mt= default value (overridden by GREP_COLORS mt=, ms=, mc=)
if (env_grep_colors == NULL && env_grep_color != NULL)
set_color(std::string("mt=").append(env_grep_color).c_str(), "mt=", color_mt);
else if (grep_colors == NULL)
grep_colors = DEFAULT_GREP_COLORS;
Expand Down Expand Up @@ -5744,7 +5744,7 @@ void terminal()
copy_color(color_mc, color_mt);

// if OSC hyperlinks are OK (note that "hl" does not match color letters so strstr can be used)
if (strstr(grep_colors, "hl") != NULL || (flag_colors != NULL && strstr(flag_colors, "hl") != NULL))
if ((grep_colors != NULL && strstr(grep_colors, "hl") != NULL) || (flag_colors != NULL && strstr(flag_colors, "hl") != NULL))
{
char *cwd = getcwd0();
if (cwd != NULL)
Expand All @@ -5760,7 +5760,7 @@ void terminal()
}

// if CSI erase line is OK (note that ne does not match color letters so strstr can be used)
if (strstr(grep_colors, "ne") == NULL && (flag_colors == NULL || strstr(flag_colors, "ne") == NULL))
if ((grep_colors == NULL || strstr(grep_colors, "ne") == NULL) && (flag_colors == NULL || strstr(flag_colors, "ne") == NULL))
color_del = "\033[K";

color_off = "\033[m";
Expand Down
2 changes: 1 addition & 1 deletion src/ugrep.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#define UGREP_HPP

// ugrep version
#define UGREP_VERSION "3.3.6"
#define UGREP_VERSION "3.3.7"

// disable mmap because mmap is almost always slower than the file reading speed improvements since 3.0.0
#define WITH_NO_MMAP
Expand Down
72 changes: 40 additions & 32 deletions vs/ugrep/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,25 +121,26 @@ Copy directory zstd-dev with its contents here.

Follow the instructions to build the Release Win32 and x64 versions of the libzstd static ZSTD library compiled with Visual Studio C++ to libzstd_static.lib:

https://github.com/facebook/zstd/tree/dev/build
https://github.com/facebook/zstd/tree/dev/build

After completing the steps above, this directory should contain the following directories and files (versions may differ):

api
bzip2-1.0.5
lz4-dev
pcre2-10.37
Release
ugrep
x64
zlib-1.2.11
zstd-dev
liblzma-x32.lib
liblzma-x64.lib
pcre2-x32.lib
pcre2-x64.lib
README.txt
ugrep.sln
api
bzip2-1.0.5
lz4-dev
pcre2-10.37
Release
ugrep
x64
zlib-1.2.11
zstd-dev
liblzma-x32.lib
liblzma-x64.lib
pcre2-x32.lib
pcre2-x64.lib
README.txt
ugrep.sln
manifest.xml

Open vs\ugrep\ugrep.sln in Visual Studio. Upgrade the version if prompted.

Expand All @@ -163,6 +164,9 @@ Configuration Properties
Additional Library Directories: $(ProjectDir)\..;$(ProjectDir)\..\zstd-dev\build\VS2010\bin\Win32_Release
Input:
Additional Dependencies: pcre2-x32.lib;liblzma-x32.lib;libzstd_static.lib
Manifest Tool:
Input and Output:
Additional Manifest Files: $(ProjectDir)\..\manifest.xml

Then build ugrep in Visual Studio.

Expand Down Expand Up @@ -225,25 +229,26 @@ Copy directory zstd-dev with its contents here.

Follow the instructions to build the Release Win32 and x64 versions of the libzstd static ZSTD library compiled with Visual Studio C++ to libzstd_static.lib:

https://github.com/facebook/zstd/tree/dev/build
https://github.com/facebook/zstd/tree/dev/build

After completing the steps above, this directory should contain the following directories and files (versions may differ):

api
boost_1_72_0
bzip2-1.0.5
lz4-dev
Release
ugrep
x64
zlib-1.2.11
zstd-dev
libboost_regex-vc141-mt-s-x32-1_72.lib
libboost_regex-vc141-mt-s-x64-1_72.lib
liblzma-x32.lib
liblzma-x64.lib
README.txt
ugrep.sln
api
boost_1_72_0
bzip2-1.0.5
lz4-dev
Release
ugrep
x64
zlib-1.2.11
zstd-dev
libboost_regex-vc141-mt-s-x32-1_72.lib
libboost_regex-vc141-mt-s-x64-1_72.lib
liblzma-x32.lib
liblzma-x64.lib
README.txt
ugrep.sln
manifest.xml

Open vs\ugrep\ugrep.sln in Visual Studio. Upgrade the version if prompted.

Expand All @@ -267,5 +272,8 @@ Configuration Properties
Additional Library Directories: $(ProjectDir)\..;$(ProjectDir)\..\zstd-dev\build\VS2010\bin\Win32_Release
Input:
Additional Dependencies: liblzma-x32.lib;libzstd_static.lib
Manifest Tool:
Input and Output:
Additional Manifest Files: $(ProjectDir)\..\manifest.xml

Then build ugrep in Visual Studio.
7 changes: 7 additions & 0 deletions vs/ugrep/manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<ws2:longPathAware>true</ws2:longPathAware>
</windowsSettings>
</application>
</assembly>

0 comments on commit d190ac4

Please sign in to comment.