>>>>> "Tom" == Tom Limoncelli <t...@whatexit.org> writes:
Tom> I have a file called rc-addition that contains: Tom> # BEGIN project Tom> a Tom> bunch Tom> of Tom> lines Tom> # END project Tom> I want to append it to the end of /etc/rc.machine but if there is already a Tom> "# BEGIN project" / "# END project" it should replace that text, or delete Tom> it and append the new text to the end. Tom> This sounds like a job of sed but my sed fu is weak. Tom> Who can do this in 1 line? I'd do it very clearly in two lines: $ perl -ni -e 'print unless /^# BEGIN project/../^# END project/' /etc/rc.machine $ cat rc-addition >>/etc/rc.machine Don't be clever. Your brain at 3am in three months will not remember why you did it in one line. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <mer...@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/> Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion _______________________________________________ Discuss mailing list Discuss@lopsa.org http://lopsa.org/cgi-bin/mailman/listinfo/discuss This list provided by the League of Professional System Administrators http://lopsa.org/