Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个:
sed -i "s/PID:\([0-9]*\)/PID:${$}/" "${ARCHIVO_INFO_SESION}"
PID:这将修改单词后保存在文本文件中的PID 。
PID:
我的问题是,是否可以仅引用之间的子匹配,( )而不必在替换部分中再次写入PID:,例如:
( )
sed -i "s/PID:\([0-9]*\)/\1${$}/" "${ARCHIVO_INFO_SESION}"
谢谢!
尝试
sed "s/\(PID:\)[0-9]*/\1${$}/" "${ARCHIVO_INFO_SESION}"
希望这可以帮助,