On Mon, 27 Nov 2017, Philip Hands wrote: > I'm not sure its important, but when testing a similar script I came up > with something that seems to give better results on the (perhaps > demented) test case I was playing with. Here's mine: > > 's/\([^= ]\+\|\([^= ]*=\("[^"]*"\|'"'[^']*'"'\|[^"'"'"' ][^ ]*\)\)\)\( > \|$\)/\1\n/g' > > The sed is not as nice to look at though. I attach my test script.
Yeah, it works. I updated my pu/kernel-cmdline-preseed to use this except that I dropped one set of useless parenthesis (the one in the middle of the stack). And I added a comment explaining the regular expression as this: # read this as (single-word|var-name=("value"|'value'|unquoted-value))(space|EOL) > BTW Should we actually be outputting the bits that contain no '=' for this? > If not, we could just pipe into: > > grep = I added this as well, although the shell code afterwards already skips over if the value is determined to be empty. Cheers, -- Raphaël Hertzog ◈ Debian Developer Support Debian LTS: https://www.freexian.com/services/debian-lts.html Learn to master Debian: https://debian-handbook.info/get/