On Wed, 22 Dec 2004 09:38:47 +0530, Kumar Appaiah <[EMAIL PROTECTED]> wrote: > Dear List, > This query relates to grep. In the command > > # ps ax|grep 'cron' > > I get the output as two lines; one for crond and one for grep 'cron' > itself. However, only the crond line appears if 'cron' is replaced > with '[c]ron' above. Why is this? Is [c] not the same as 'c', i.e. a > character list with a single character? The info page mentions the > above gotcha, but I could not find the reason for it. Could you please > clarify?
You are right. '[c]ron' is treated exactly the same as 'cron' by grep. But when grep sees the ps listing, there is only one process matching 'cron' - the daemon. The other one is "grep [c]ron" and to match this, your regexp should be '\[c\]ron'. Binand ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ linux-india-help mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-india-help
