Op 7 nov. 2015 16:37 schreef "Dan Ritter" <d...@randomstring.org>:
>
> 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

Quick: what will the contents of "originalfile" be after this command?
Sorry, couldn't resist the temptation ;).

Other then that; in this specific case, an -almost- empty file might be
less confusing then an completely commented-out file. Especially when you
encounter this at some point in the future  (months or even years later).

Mvg, Guus Snijders
_______________________________________________
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/

Reply via email to