On Mon, Nov 07, 2005 at 01:44:42AM -0200, Rafael Barreto wrote: > Hi, > > I'm learning about the use of the sed command and I have some questions. I'm > trying to read in /etc/conf.d/clock the CLOCK variable with: > > sed '/^CLOCK="*"$/p' /etc/conf.d/clock > > This command, in principe, must print in screen the line that contains > CLOCK= in the begin, contains anything between double quotes and ends. Well, > this doesn't return anything. If I enter the above command without $, all is > ok. But, if I would like to return just that line contains CLOCK="anything" > and nothing more? For example,
No it doesn't. What you want is the regexp ^CLOCK=".*"$ if you want anything (including nothing) between the double quotes, or ^CLOCK=".+"$ if you want something (excluding nothing) between the double quotes. The reason that removing the trailing $ worked is that it matched the CLOCK=" part, the * character specifies 0 or more iterates of the previous character, which is " HTH W -- Q: Why won't Heisenberg's operators live in the suburbs? A: They don't commute. Sortir en Pantoufles: up 4 days, 5:24 -- [email protected] mailing list

