linux - 使用 sed 在每行的开头插入文本

标签 linux unix shell sed awk

如何使用 sed 来插入

rm -rf

在文件每一行的开头?

最佳答案

sed 's/^/rm -rf /' filename

编辑

Xargs 是删除另一个文件中列出的所有文件的更简单方法

xargs -a filename rm -rf

关于linux - 使用 sed 在每行的开头插入文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4080526/

相关文章:

objective-c - 调试statfs?

c++ - 我该如何解决此构建错误 : "no matching function for call to" in C++ under UNIX?

bash - 在 bash 中修剪尾部和前导斜杠 - 加入参数替换?

shell - 跨 session 永久清除 fish shell 历史记录

python - 我应该把#! (shebang) 在 Python 脚本中,它应该采用什么形式?

linux - 从Docker容器访问网络驱动器

linux "make oldconfig"丢弃条目 CONFIG_K8_NB

c - 最佳本地套接字命名实践

c - GCC 无法编译 libcurl 示例 : ‘CURLINFO_TOTAL_TIME_T’ undeclared

python - numdisplay ds9 在 Debian Linux 上崩溃