bzgrep- Unix, Linux Command


Advertisements

Previous Page
Next Page  
 

NAME

bzgrep: search possibly bzip2 compressed files for a regular expression.

SYNOPSIS

bzgrep [ grep_options ] [ -e ] pattern filename.

DESCRIPTION

Bzgrep is used to invoke the grep on bzip2-compressed files. All options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If bzgrep is invoked as bzegrep or bzfgrep then egrep or fgrep is used instead of grep.

 

EXAMPLES

EXAMPLE-1:

Search operation in bzip2 file using bzgrep :

$ bzgrep ps  system_proc_1.bz2


output:
root 2352 1 0 11:36 ? 00:00:00 /usr/sbin/cupsd -f
nubo 2895 2870 0 13:30 pts/13 00:00:00 ps -ef

EXAMPLE-2:

Search operation in bzip2 file using bzgrep and output as count of matching lines:

$ bzgrep -c ps system_proc_1.bz2

output:

2

EXAMPLE-3:

Search operation in bzip2 file using bzgrep and in output Print the filename for each match:

$ bzgrep -H ps system_proc_1.bz2

output:


system_proc_1.bz2:root 2352 1 0 11:36 ? 00:00:00 /usr/sbin/cupsd -f
system_proc_1.bz2:nubo 2895 2870 0 13:30 pts/13 00:00:00 ps -ef

 

EXAMPLE-4:

Search operation in bzip2 file using bzgrep and  output with line number:

$ bzgrep -n ps system_proc_1.bz2

output:


31:root 2352 1 0 11:36 ? 00:00:00 /usr/sbin/cupsd -f
43:nubo 2895 2870 0 13:30 pts/13 00:00:00 ps -ef

 

EXAMPLE-5:

To check version of  bzgrep:

$ bzgrep -V ps system_proc_1.bz2

output:


grep (GNU grep) 2.16
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Haertel and others, see <http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.

 

 (bzegrep and bzfgrep commands will apply egrep and freg operation on bzip2 files respectively.)
 

Previous Page
Next Page