[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: No response from grep

From: Seth David Schoen
Subject: Re: No response from grep
Date: Mon, 3 Jun 2013 15:25:17 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

Clayton Gillespie writes:

> Problem:  grep does not respond when given a valid command, but produces
> errors for option typos

The default behavior of grep is to search for the requested string in
its input, rather than in a file.  This is useful in using grep as part
of a pipeline in which several commands are strung together; then grep
can be used to find the parts of the output of one command which match
a certain pattern.

When no file is specified, grep follows this default behavior.  It's
not unresponsive -- it's just waiting for you to type in input which
it will then search for the pattern you specified.

If you say

fgrep -e Context testfilename

you should see the output you were expecting.

An example that shows grep searching its input would be

seq 1 20 | grep '[02468]$'

to select only the even numbers from the output of the seq command.

Seth David Schoen <address@hidden>      |  No haiku patents
     http://www.loyalty.org/~schoen/        |  means I've no incentive to
  FD9A6AA28193A9F03D4BF4ADC11B36DC9C7DD150  |        -- Don Marti

reply via email to

[Prev in Thread] Current Thread [Next in Thread]