in reply to replace a string multiple times
The {3} you tried to use is for the pattern, not for the replacement. If you want to build the replacement string "on the fly", use the /e modifier (evaluate code) and build the string using ordinary Perl expressions: perl -p -i -e "s/int/join q[ ],(q[int])x3/ge", or just s/int/int int int/g.