Hello Linux Geeksters. As you may know, Grep is an open-source, command-line tool for searching plain-text data sets for lines that match regular expressions.
The latest version available is Grep 2.21, which has been recently released, coming with the below changes and improvements.
- Performance has been greatly improved for searching files containing holes, on platforms where lseek’s SEEK_DATA flag works efficiently.
- Performance has improved for rejecting data that cannot match eventhe first part of a nontrivial pattern.
- Performance has improved for very long strings in patterns.
- If a file contains data improperly encoded for the current locale, and this is discovered before any of the file’s contents are output, grep now treats the file as binary.
- grep -P no longer reports an error and exits when given invalid UTF-8 data. Instead, it considers the data to be non-matching.
- grep no longer mishandles patterns that contain \w or \W in multibyte locales.
- grep would fail to count newlines internally when operating in non-UTF8 multibyte locales, leading it to print potentially many lines that did not match.
- grep -F -x -o no longer prints an extra newline for each match.
- grep in a non-UTF8 multibyte locale could mistakenly match in the middle of a multibyte character when using a ‘^’-anchored alternate in a pattern, leading it to print non-matching lines.
- grep -F Y no longer fails to match in non-UTF8 multibyte locales like Shift-JIS, when the input contains a 2-byte character, XY, followed by the single-byte search pattern, Y. grep would find the first, middle-of-multibyte matching “Y”, and then mistakenly advance an internal pointer one byte too far, skipping over the target “Y” just after that.
- grep -E rejected unmatched ‘)’, instead of treating it like ‘\)’. On NetBSD, grep -r no longer reports “Inappropriate file type or format”when refusing to follow a symbolic link.
Changes in behavior:
- The GREP_OPTIONS environment variable is now obsolescent, and grep now warns if it is used. Please use an alias or script instead.
- In locales with multibyte character encodings other than UTF-8, grep -P now reports an error and exits instead of misbehaving.
- When searching binary data, grep now may treat non-text bytes as line terminators. This can boost performance significantly.
- grep -z no longer automatically treats the byte ‘\200’ as binary data.
In this article I will show you how to install Grep 2.21 on Arch Linux, Antergos, Manjaro and other Arch Linux based systems.
Because it is available via AUR, installing Grep 2.21 on Arch Linux and derivative systems is easy. Just do:
$ sudo pacman -Sy yaourt
$ sudo yaourt grep
Optional, to remove Grep on Arch Linux, Manjaro and Antergos systems, do:
$ sudo yaourt -Rsn grep
Leave a Reply