Originally Posted by smallpond
Not sure about Solaris, but on Linux you need '-e' before your substitution to tell it to execute the following script.
You can use -e, but it's not a requirement. I find that it can help to break up multiple, independent patterns with multiple -e options just to make things easier to understand, but for quickie one-liners, I rarely use the -e switch.
Also, I'm not too familiar with Solaris. My main suggestion though is you should enclose your sed script in quotes. This prevents the shell from looking at your script and trying to find job control/wildcard characters to interpret or expand. For bash, the '&' character (among others) is a job control character meaning to send the command to the background. Using quotes also saves you from a lot of backslash-escaping.
user@localhost$ echo "NotWorking" | sed 's/[a-z]/(&)/'
As you can see, the sed substitution takes place only once. Your original goal is to add the parentheses around each (lowercase?) character, then something like:
user@localhost$ echo "NotWorking" | sed 's/[a-z]/(&)/g'
Lastly, if you truly wanted parentheses around every
user@localhost$ echo "NotWorking" | sed 's/[a-zA-Z]/(&)/g'