I have a short test file (named "dict") comprising 25 words, each on a separate line. A few of these words are the plural form of the word above (e.g. "aardvark" followed by "aardvarks"). I want to mark all the words that end with an "s" as part of a larger project that will eventually delete plural forms from a much larger file (over 100,000 words), but my only concern at this stage of my self-education is to target those words that end with an "s" by replacing the terminal "s" with an "x".
I thought it could be done with the following:
Code:
sed "s/s$/x/g" <dict
However, that returns exactly the contents of the "dict" file with no replacements.
I can replace
all "s" characters with
Code:
sed "s/s/x/g" <dict
and I can replace all initial "a" characters with
Code:
sed "s/^a/x/g" <dict
but the end-of-line $ isn't doing what I expected.
I'm using Kubuntu 12.04, if that makes any difference. Any ideas where I should look for a fix?