-m
Stop reading a file after NUM matching lines.
$grep -m 1 wc wcwidth.c
#include
$grep -m 2 wc wcwidth.c
#include
wchar_t cr;
$grep -m 3 wc wcwidth.c
#include
wchar_t cr;
value=wcwidth(cr);
$grep -m 4 wc wcwidth.c
#include
wchar_t cr;
value=wcwidth(cr);
$grep -m 0 wc wcwidth.c
$
scripts/makelst - 338 identical
19: t1=`$3 --syms $1 | grep .text | grep -m1 " F "`
20: if [ -n "$t1" ]; then
android.git.kernel.org/kernel/common.git - GPL - Shell
Searching for a pattern in a text file is a very common operation
in many applications ranging from text editors and databases to
applications in molecular biology. In many instances the pattern
does not appear in the text exactly. Errors in the text or in the
query can result from misspelling or from experimental errors
(e.g., when the text is a DNA sequence). The use of such
approximate pattern matching has been limited until now to
specific applications. Most text editors and searching programs
do not support searching with errors because of the com-
plexity involved in implementing it. In this paper we describe a
new tool, called agrep, for approximate pattern matching. Agrep
is based on a new efficient and flexible algorithm for approximate
string matching. Agrep is also competitive with other tools for
exact string matching; it include many options that make
searching more powerful and convenient.
source :
AGREP — A FAST APPROXIMATE PATTERN-MATCHING TOOL
(Preliminary version)
Sun Wu and Udi Manber1
Department of Computer Science
University of Arizona
Tucson, AZ 85721
(sw | udi)@cs.arizona.edu