replace part of text of a line

Gurus,
You know, I believe you do:-), the comnand uname -r give you the kernel version:

serverA:~# uname -r
2.6.26-1-xen-amd64

So, I want to replace this output inside in the line below that is inside the file:

kernel = '/boot/vmlinuz-2.6.26-1-xen-amd64'

Suppose, you move this file to ther server with another kernel:

serverB:~# uname -r
2.6.26-2-xen-amd64

Question, how can I replace the line to fit the new version? Like this:

kernel = '/boot/vmlinuz-2.6.26-2-xen-amd64'

regards,
Israel.

Something like this?

sed "/kernel =/s/-.*/-`uname -r`'/" file > newfile

perfect!!

really appreciate Franklin.. :slight_smile:

regards
Israel