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

Re: grep question



On Mon, Apr 08, 2002 at 04:41:08PM +0200, Johann Spies wrote:
> In the grep's info page I find the following which works as said.  But
> I want to know why.  What does the [c] do in this case?

It tells grep to find four character words that start with the letter
'c' and end with the three letters 'ron'.

The argument to grep is a *six* character word that starts with '[' so
it doesn't match.

> ------------------------
>   7. Why do people use strange regular expressions on `ps' output?
> 
>           ps -ef | grep '[c]ron'
> 
>      If the pattern had been written without the square brackets, it
>      would have matched not only the `ps' output line for `cron', but
>      also the `ps' output line for `grep'.
> 
> -------------------------------

-- 
"Once the principle of government -- judicial monopoly and the power
 to tax -- is incorrectly accepted as just, any notion of restraining
 government power and safeguarding individual liberty and property is
 illusory." -- Hans-Herman Hoppe
    Rick Pasotto    rickp@telocity.com    http://www.niof.net


-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: