I am currently writing a script package to read and modify some configuration files on Windows. Fortunately, I have access to the above, and so I can use this for most of what I need to do, albeit with some quirks because of the environment.
The statement I would like to execute is as follows:
sed '/\[$/{:loop N /^^]/!b loop} s/\n//g'
Which should theoretically remove any newlines on the lines between lines with square brackets. I use double patterns to exit and use the second (quirk cmd.exe ). However, it does not work with the following error:
sed: -e expression
When testing some other statements, I got the following results.
sed '/\[/{ s/.*//g }' - Runs exactly as it should
sed '/\[/{ N } s/.*//g' - Crash with sed: -e expression #1, char 11: extra characters after command
sed 's/^^ */^&\n/ :loop s/.*/asdf/ b loop' - Failed with sed: -e expression #1, char 12: unknown option to s'``
I'm just not sure if my error is related to my main expression due to the fact that I'm twisting the syntax, or if it's just because I'm on Windows. Any thoughts or help you can provide would be great.
windows unix regex cmd sed
Evan
source share