First, understand that ".
" has a special meaning in regular expressions
. It stands for "any character". So '.1
' will match any single character followed by a one, i.e. 'a1
', ' 1
To make it literal you have to either backslash escape it or enclose it in 
Second, in sed
' substitution expression, the entire left side
match is replaced by the right side string. So if you want to carry over any values you have to use regex backreference capturing.
millgates' reply shows one working version, although I would give it a more precise matching expression. His version just matches everything from the beginning of the line up to the first literal period. If the line contained a period before the one you wanted, it would insert the _seq
in the wrong place.
I would also add one more thing. It's a gnu extension that allows you to enable extended regex features through backslashing. A cleaner and more readable way to get the same effect is to use the -r
option, and just enable ext-re globally.
sed -r 's/(CUFF[.][0-9])[.]([0-9])/\1_seq\2/'
Add a 'g
' to the end if more than one string can exist on a single line, as mentioned.
See the grep
man page for a good explanation of basic
regular expressions. And when you have a chance, take some time to study up on regex in general. You'll be glad you did.
Here are a few regular expressions tutorials: