On Wednesday 22 December 2004 09:38, Kumar Appaiah 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?
No. [c] is not the same as c. It is like saying that xyz is the same as XYZ. You have told it to grep '[c]ron' which is actually 'cron'. But, ps gives grep line as 'grep [c]ron'. So, it means that you are actualy searching for cron which is not [c]ron. grep does not treat text as regexprs. It is just the string that does the regexprs. > Thank you. > > Kumar ------------------------------------------------------- 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
