Before I respond, quick apologies to the list for not replying to the right spot.
David Lutterkort <[EMAIL PROTECTED]> wrote on 07/17/2008 03:12:00 PM: > On Thu, 2008-07-17 at 14:21 -0500, [EMAIL PROTECTED] wrote: > > > > David Lutterkort <[EMAIL PROTECTED]> wrote on 07/17/2008 01:03:59 PM: > > > How exactly did you do this ? Augeas uses extended POSIX regexp > > > syntax[1] - that syntax is also used by some command line tools. For > > > playing with individual regexps, it's sometimes useful to play e.g. with > > > sed and do 'sed -r -e 's/MYREGEXP/FOO/' to see exactly what a regexp > > > matches ... like 'sed -r -e 's/[ \t]*/<spaces>/' will replace > > > whitespaces on an input line with the literal string '<spaces>'. > > > > I tried it multiple ways. I used grep and sed... although I did not use > > the '-r -e'. And based on the check I just ran it behaves differently... > > hrmph... > > The '-r' is essential since it switches to extended POSIX regexp syntax > (instead of basic syntax, which is quite different) okay... that helps to be kept in mind. > > Basically I started by slowly following the trail of the regex, using grep > > to verify a line matches and sed to remove the match. > > > > So if augeas/files/*/error showed: > > (((([A-Z_]*)([ \t]*))(((([a-z_]+)(=))([^,:= \t\n]*))|([a-z_]+)(=))([^,:= > > \t\n]*))|([a-z_]+)))*))(\n) > > > > I would break it down to ($file is the originally attached onconfig.test) > > > > grep "\([A-Z_]*\)" $file > > sed "s/\([A-Z_]*\)//" $file > > It might be easier to go the other way: take small snippets of the > config file, and run 'test LNS get SNIPPET = ?' on it - you can use any > lens in a test, not just the 'main' lens from a module. Unfortunately, I don't think I'm going to get far on this before next week, but unless my priorities get changed I'll be pushing along with the test creation next week. Implementing augeas looks like it would be a major win for my org (whether they know it yet or not). > > But i did just try the -r with that and > > sed "s/\([A-Z_]*\)\([ \t]*\)//" $file > > sed -r "s/\([A-Z_]*\)\([ \t]*\)//" $file > > give much different results > > Yeah, one of the big differences between extended and basic POSIX syntax > is that to match 0 or more 'a's in extended syntax is 'a*' whereas in > basic syntax it's 'a\*'. ok. but then why did the basic syntax do what I wanted and not the extended? -greg _______________________________________________ rhelv5-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/rhelv5-list
