Sed command - command garbled errror
I am a lerner to sed.Was just trying to run the following command on solaris:
echo "NotWorking" |sed s/[a-z]/\(&\)/ Basically want to add to every char with '( )' but i get command garbled error. Need help. Thanks |
Not sure about Solaris, but on Linux you need '-e' before your substitution to tell it to execute the following script.
|
Quote:
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. For instance: Code:
user@localhost$ echo "NotWorking" | sed 's/[a-z]/(&)/' Code:
user@localhost$ echo "NotWorking" | sed 's/[a-z]/(&)/g' Code:
user@localhost$ echo "NotWorking" | sed 's/[a-zA-Z]/(&)/g' |
Thanks smallpod and Dark_Helmet - It did worked on Linux but the same command did not work on solaris.Thanks i could try it on my home linux machine.
|
All times are GMT -5. The time now is 07:17 AM. |