不要逃避*并使用[^\\]*不跳过\:
*
[^\\]*
\
sed -i 's/BOO[^\\]*\\/cusomdata/g' file.txt.
如果你想保留分隔符,不要捕获尾随\并放回BOO:
sed -i 's/BOO[^\\]*/BOOcusomdata/g' file.txt.