Hi everyone, esp Dave. On 11/14/08 07:30, Dave Miner wrote: > Jack Schwartz wrote: > >> Hi everyone. >> >> Here is a revised webrev of code to get rid of the Hard Disk entry in >> the grub menu for USB sticks. >> >> Try as I might, I couldn't figure out a way using sed to do what I >> needed to do. So, instead I wrote a function to do it: it looks for >> lines with "Hard Disk" in them, and then deletes until either a blank >> line is seen or the word "title" appears at the beginning of a line. >> "Title" lines are kept in; blank lines are deleted. >> >> http://cr.opensolaris.org/~schwartz/081112.1/webrev/ >> >> It's not a one-liner anymore, but should be straightforward enough... >> >> > > It's OK, but I do recommend getting to know nawk; it does a lot more > than sed, much more compactly than the shell: > > nawk ' > BEGIN { inhard=0 } > /^title.*Hard Disk$/ { inhard=1 } > /^title/ { if (index($0,"Hard Disk") == 0) inhard=0 } > inhard == 0 {print} > ' menu.lst > > does exactly what you want. > Wow! How cool is that? Thanks, Dave!
I've basically taken this, and indented the code between the single-quotes. I tested doing a build, and also verified via a test script that the Hard Disk entry (entries) get removed wherever they are in the menu. Webrev updated at the same location: http://cr.opensolaris.org/~schwartz/081112.1/webrev/ On the caiman-discuss IRC channel, Dave has already approved this change, so I need only one more reviewer. Thanks, Jack -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.opensolaris.org/pipermail/caiman-discuss/attachments/20081114/a4983b11/attachment.html>
