On Thursday 05 September 2002 3:47 pm, Angus Leeming wrote: > On Thursday 05 September 2002 3:58 pm, Lars Gullik Bjønnes wrote: > > | // This file is part of LyX, the document processor. > > | // Licence details can be found in the file COPYING. > > | > > | I think that that cuts it don't you? At least it describes /why/ anyone > > | would want to read COPYING. > > > > Yes, let's do this. I guess this is the most we can reach consensus > > on... > > Modified script is attached.
If you want to see some scary sed, then this was posted to the sed users list. It is a reply to my question asking how to add that line "Full author contact details available in file CREDITS" after the last occurance of \author /\\author/ !{ x /\\author/ i\ *\ * Full author ... x } h The idea is that we on every lap save the line in the hold buffer. Then we first match a pattern matching the block end-condition, and then match the block condition before we insert anything. This is a more general way to do something after a block. This is in comparison to my hack (below). Ain't some things amazing? Angus # extract the number of the last \author line LINES=`grep -n '[\]author' ${FILE}` STATUS=$? EXISTSALREADY=`grep 'Full author contact details' ${FILE}` if [ ${STATUS} -eq 0 -a $? -ne 0 ]; then LINES=`echo "${LINES}" | sed 's/\([0-9]*\):\(.*\)/\1/'` LINE=`echo "${LINES}" | sed '$ !d'` APPENDSCRIPT fi APPENDSCRIPT () { # Must define ${SED} and ${LINE} in the main body of the script cat - >> ${SED} <<EOF # append this line after the last occurance of author ${LINE} a\\ *\\ * Full author contact details are available in file CREDITS EOF }