Sorry, was just the perfectionist in me. Most all this is really mute since we still don't understand what the ? is for. (i.e. you can ignore this babbling geek)
To start, I aggree with holding off on the correction.
But to the regex itself, the core of the _expression_ is the grouping [^ ?] (which will match anythingthing but blank or ?), but they wanted to make sure there was at least 1 character. So originally that repeated it once and used the * on the second, which is the regex modifier for 0 or more times. The plus sign is the regex for 1 or more. So they end up being the same. However, long story short, not sure if it was needed since they put that inside of beginning and end of line markers (the very first carat ^, and the ending dollar $).
The complication comes when they have to be escaped. The shell is grabbing some of those characters and doing its own thing with them first. For instance, the parenthesis are being escaped to get them thru the shell and to the regex pattern.
The plus sign must need that to. My only question is, why don't we need to escape the asterick. But there's more than one way to do it.
Greenacre, Evan R CIV NSWCDD, K54 schreef:
> Sorry if this gets threaded wrong.
>
> But the SED script, the plus sign doesn't work unless its escaped:
>
> sed -i 's/^\([^ ?]\+\)$/\1 ?/' $i
Doesn't that make it a literal plus instead of a regex plus?