Appending to end of a line using 'sed'

I have a line that says...

Fred Flintstone, Bedrock USA

and I want it to look like...

Fred Flintstone, Bedrock USA ***

How do I append a few * to the end of the line using sed command?


You can use this:

sed 's/$/ ***/' filename

If you want to search for a specific string before appending to a line (that is you don't want it appended to EVERY line like the above command) you can use the following, this finds Fred Flintstone anywhere in a line, put^ in front if you only want to match the beginning of the line.

sed '/Fred Flintstone/ s/$/ ***/' filename