On 1/17/06, Norman Urs Baier <[EMAIL PROTECTED]> wrote:
> Probably I did run the sed script twice, even though I thought I had deleted
> the source tree and started from beginning. Anyway running the sed script
> twice gives me an error which reminds of the one I got when trying the first
> time.

Yes, running sed more than once is a very bad idea unless you're
making backups or visually inspecting the file afterwards.

> I am no expert in sed script, does the ampersand mean, you just append
> someting, without actually modifying the trigger? Seems I made a fool out of
> me twice in this thread... Sorry.

Yes, the & is an alias for the entire regex (first part after s/). 
So, all this sed matches is "    enum" and then it adds "
xptinfo_enum_1" to the end.  So, running it twice results in

    enum xptinfo_enum_1 xptinfo_enum_1

I'm no C expert, but that's probably gonna cause a problem.

A more accurate sed that could be run repeatedly is

sed -i 's/^    enum$/& xptinfo_enum_1/' whatever/file/it/is

That way it has to match the beginning of a line (^), the "    enum"
part, and the end of a line($).  Then it won't match after you add the
" xptinfo_enum_1" part to the end.

Thus concludes todays lesson on sed.

--
Dan
--
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to