????aca
?aca
tr
使用反向引用,sed 看起来很容易:
sed 's/\(.\)\1\+/\1/g' infile
.
?
\?
sed 's/[?]\{2,\}/?/g' YourFile
tr -s
tr -s '?' <file >file.new
.
替换为?
(如果对于您的正则表达式它是特殊字符,则替换为\?
)。 - Olivier Dulac