[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: sed problems: Inserting a line at the FIRST match only



Christoph Lameter <clameter@waterf.org> writes:

> I have a problem of inserting a font path into /etc/X11/XF86Config at a
> specific location after the last FontPath statement in the first section
> of XF86Config.
> 
> I cannot figure out how to convince sed to only do something at the first
> location and EndSection occurs. Can somebody help me?

But what if the Files section isn't first?  Something like this is
better:

sed -e '
/Section *"Files"/,/EndSection/{
	/EndSection/i\
	FontPath "Some/New/Font/Path"
}'

Use the same scheme to take it out instead of just doing a delete
through the whole file.  It's safer.



Guy

--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-REQUEST@lists.debian.org . Trouble? e-mail to Bruce@Pixar.com


Reply to: