2011/3/28 Rony gnulinuxist@gmail.com:
s/ MA/, Massachusetts/ s/ PA/, Pennsylvania/ s/ CA/, California/ s/ VA/, Virginia/ s/ OK/, Oklahoma/
However when I give this as input to the file called 'list', I get an error:- sed: file sedscr line 1: unknown option to `s'
You need to put each substitution in a new line.
In the earlier examples of substitution sed 's/MA/Massachusetts/" list works only on the first instance of MA and not all which goes against their statements that sed commands are global by default unless the address is specified. The above command will work globally only if the /g option is put in the right had side.
The global in "their" context is that "applies to all lines in the file". The "globally" in your /g context is that "applies to all occurrences of pattern in a line". See the difference?
Is there any good website where I can learn sed and regular expressions.
I have a copy of the book you are using; I doubt if there is a better beginner's reference to sed/awk.
Binand