paragrep man page on DragonFly

Man page or keyword search:  
man Server   44335 pages
apropos Keyword Search (all sections)
Output format
DragonFly logo
[printable version]

PARAGREP(1)							   PARAGREP(1)

NAME
       paragrep - search paragraphs in a file for patterns

SYNOPSIS
       paragrep [ -aiotv ] [ -p eop_expression ] [ -e expression ] [ -f
       exp_file ] ...  [ file ] ...

       or

       paragrep [ -itv ] [ -p eop_expression ] expression [ file ] ...

DESCRIPTION
       Paragrep is a paragraph grep utility.  It searches for a series of reg‐
       ular expressions in a text file (or several text files) and prints out
       the paragraphs containing those expressions.  Normally a paragraph is
       displayed if it contains any of the expressions; this behavior can be
       modified by using the -a option.

       By default, a paragraph is defined as a block of text delimited by an
       empty or blank line; this behavior can be altered with the -p option.

       If no files are specified on the command line, paragrep searches stan‐
       dard input.

OPTIONS
       -a	      The "and" option: Only display a paragraph if it con‐
		      tains all the regular expressions specified.  The
		      default is to display a paragraph if it contains any of
		      the regular expressions specified. (See the -o option,
		      below.)

       -e expression  Adds a regular expression to the set of expressions
		      against which paragraphs are to be matched.   More than
		      one -e argument may be specified.	 If only one expres‐
		      sion is specified, the -e may be omitted, as in the sec‐
		      ond form of the command, above.

       -f expfile     Specifies a file containing regular expressions, one
		      expression per line.  Each expression in the file is
		      added to the set of expression against which paragraphs
		      are to be matched.   More than one -f argument is per‐
		      mitted. Also, -f and -e may be specified together.

       -i	      Considers upper- and lower-case letters to be identical
		      when making comparisons.

       -o	      The "or" option: Display a paragraph if it contains any
		      of the regular expressions specified.  Since this option
		      is the default, it is rarely specified on the command
		      line.  It exists primarily to negate the effect of a
		      previous -a option.  (e.g., If you've defined an alias
		      for paragrep that specifies the -a option, -o would be
		      necessary to force the "or" behavior.)

       -p eop_expression
		      Specifies a regular expression to be used match para‐
		      graph delimiters.	 Any line that matches this regular
		      expression is assumed to delimit paragraphs without
		      actually being part of a paragraph (i.e., lines matching
		      this expression are never printed).  If this option is
		      not specified, it defaults to `^[ \t]*$' which matches
		      blank or empty lines.  (`\t' represents the horizontal
		      tab character.  If you need to specify a horizontal tab,
		      you'll need to type the actual character; paragrep
		      doesn't recognize C-style metacharacters.)

       -v	      Displays all lines that do not match specified expres‐
		      sions.  The negation logic works on DeMorgan's Laws.
		      Normally, if -a is specified, paragrep uses the follow‐
		      ing logic to match the paragraph:

			     match = contains (expr1) AND contains (expr2) AND
			     contains (expr3) ...

		      Specifying -v along with -a changes this logic to:

			     match = lacks (expr1) OR lacks (expr2) OR lacks
			     (expr3) ...

		      Likewise, without -a or -v (i.e., using the -o option,
		      which is the default) the matching logic is:

			     match = contains (expr1) OR contains (expr1) OR
			     contains (expr1) ...

		      Negating that logic with -v causes paragrep to match
		      paragraphs with:

			     match = lacks (expr1) AND lacks (expr2) AND lacks
			     (expr3) ...

SEE ALSO
       ed(1), grep(1), perl(1)

BUGS
       Paragrep's notion of troff directives is overly restrictive.  To be
       less restrictive, you must conjure up a more complicated -p value.

       Paragrep reads each paragraph into a perl array before scanning it for
       matches; as a result, extremely long paragraphs can suck up memory.

       The logic behind how -v works can be confusing to the uninitiated.

AUTHOR
       Brian M. Clapper,
       http://www.clapper.org/bmc/ @@LICENSE@@

				 8 April 1995			   PARAGREP(1)
[top]

List of man pages available for DragonFly

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net