Genivia / ugrep

NEW ugrep 6.5: a more powerful, ultra fast, user-friendly, compatible grep. Includes a TUI, Google-like Boolean search with AND/OR/NOT, fuzzy search, hexdumps, searches (nested) archives (zip, 7z, tar, pax, cpio), compressed files (gz, Z, bz2, lzma, xz, lz4, zstd, brotli), pdfs, docs, and more
https://ugrep.com
BSD 3-Clause "New" or "Revised" License
2.62k stars 110 forks source link

ugrepping result error + doc with option missing #232

Closed jcdegiorgi closed 2 years ago

jcdegiorgi commented 2 years ago

Hi, First of all, congratulations for this great tool!!

Test made with ugrep version: _ugrep 3.9.2 x86_64-pc-linux-gnu +avx2 +pcre2jit +zlib +lzma

ugrep result error

I followed your tutorial and tested some of them. But this example does not seem to be correct.

Content of "myfile.txt": good diner good diner diner good Hello world

Command: ug --bool 'good|-diner' myfile.txt

Result: good good diner diner good Hello world

"Hello world" should not be here.

Doc missing option

To search for decimals using pattern \d+ that do not start with 0 using negative pattern 0\d+ and excluding 555: ug '\d+' -N '0\d+' -N 555 myfile.cpp

Should be: ug -e '\d+' -N '0\d+' -N 555 myfile.cpp

Omitting this option gives me: ugrep: warning: \d+: No such file or directory


Same case for ug '\<disp' -N '\<display>' myfile.py


To display lines that are not blank lines: ug -x '.' -N '\h' myfile.py

Gives me ugrep: warning: .*: No such file or directory

Regards, Jean-Claude

genivia-inc commented 2 years ago

ugrep result error

I followed your tutorial and tested some of them. But this example does not seem to be correct.

Content of "myfile.txt": good diner good diner diner good Hello world

Command: ug --bool 'good|-diner' myfile.txt

Result: good good diner diner good Hello world

"Hello world" should not be here.

Yes it does. It has no diner so it is a match! The search query matches if a line does not match diner but if it does match diner then it should match good. It's a form of logical implication. Ref. Boolean algebra.

Doc missing option

To search for decimals using pattern \d+ that do not start with 0 using negative pattern 0\d+ and excluding 555: ug '\d+' -N '0\d+' -N 555 myfile.cpp

Should be: ug -e '\d+' -N '0\d+' -N 555 myfile.cpp

Yes, the -e should be used when -N is used.

Omitting this option gives me: ugrep: warning: \d+: No such file or directory

Same case for ug '<disp' -N '' myfile.py

To display lines that are not blank lines: ug -x '.' -N '\h' myfile.py

Gives me ugrep: warning: .*: No such file or directory

Thanks! Will fix the doc.