You can do the same with any other compression format provided you have access to the corresponding tool. So you should be able to do: gzip -d < file.gz | grep BRE The following description applies to extended regular expressions differences for basic regular expressions are summarized afterwards. In other implementations, basic regular expressions are less powerful. Gzip (GNU zip) understands another ancient compression format that is still in use nowadays and gzip is found on most systems (either the GNU implementation or a clone). In GNU grep, there is no difference in available functionality between basic and extended syntaxes. The only compression program that POSIX specifies is compress/ uncompress which is for an ancient compression format from the early 80s that nobody uses anymore. Various compression libraries/tools provide with zgrep, bzgrep, xzgrep scripts, none of which standard. On Solaris, make sure to use /usr/xpg4/bin/grep. For portability, restrict to the list specified by POSIX. Some grep implementations have extra switches to recognise even more different regexp syntaxes like grep -P for PCRE (or perl-like, see also the pcregrep command shipped with the PCRE library), grep -X for augmented regexps.Īnd the list of operators supported by grep and grep -E varies from one system to another. That's the grep for the extended regexps (ERE), as opposed to the basic regexps (BRE) understood by grep/ sed/ ed/ vi.Īdditional operators like \ operator, some don't. That's the grep for the e xtended regexps (ERE), as opposed to the basic regexps (BRE) understood by grep / sed / ed / vi. Grep stands for 'Global Regular Expressions Print', were as Egrep for 'Extended Global Regular Expressions Print'. The z is for zip (not for the pkzip compressed archive format, but for the zipping/compression of files).Įgrep was a command introduced in Unix V7 in the late 70s with a new regexp algorithm and syntax compared to the old grep (itself a standalone command to implement the g/re/p command of the ancient ed text editor). egrep was a command introduced in Unix V7 in the late 70s with a new regexp algorithm and syntax compared to the old grep (itself a standalone command to implement the g/re/p command of the ancient ed text editor). Zgrep is generally a script shipped with gzip (see also Stephen Kitt's comment below) that greps into compressed files (with compression formats that gzip recognises).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |