On Sat, Nov 07, 2015 at 02:18:40AM +0000, Edward Ned Harvey (lopser) wrote: > > From: Brandon Allbery [mailto:allber...@gmail.com] > > > > I'm thinking the problem is that it is allowing any character to match [^#] > > --- > > including newline, which you likely do not expect. Try [^#\n] instead. > > Thanks, that worked. But I'm still going to have to conclude that it's a bug, > because the .* or .? matches the newline on a blank line, while the .* or .? > matches everything up to (and not including) the newline on non-blank lines. > > So I've got a workaround, but I'll go report it to them.
Let me suggest that editing files in place is a really finicky operation, and it would be better to do something like: cp originalfile originalfile.$DATE.backup echo # blank on purpose, see originalfile.$DATE.backup > originalfile which preserves the original for people who are mucking around in file archaeology and doesn't risk fun with regexps. Even better is to not be in this situation in the first place, by deploying all the config via generation from version-controlled management systems. -dsr- _______________________________________________ Tech mailing list Tech@lists.lopsa.org https://lists.lopsa.org/cgi-bin/mailman/listinfo/tech This list provided by the League of Professional System Administrators http://lopsa.org/