查找|xargs-sed以替换文件名中的字符串,而不是文件内容


$ echo "file_contents" > filename.txt
$ find . -type f -print0 | xargs -0 sed 's/file//g'
_contents

如何让sed将文件名视为字符串而不是输入文件?我需要什么命令才能获得";CCD_ 1";作为输出?

删除xargs-0的s。

find . -type f  | sed 's/file//g'

这取find的输出并将其作为输入发送到sed

最新更新