[英]Using sed to insert text at the beginning of each line
How would one go about using sed in order to insert 如何使用sed进行插入
rm -rf
at the start of each line of a file? 在文件的每一行的开头?
sed 's/^/rm -rf /' filename
EDIT 编辑
Xargs would be simpler way to delete all of the files listed in another file Xargs可以更简单地删除另一个文件中列出的所有文件
xargs -a filename rm -rf
Sometimes you have to go with the original method using sed, especially when you want to do things like 有时你必须使用sed的原始方法,特别是当你想做的事情
csf -d ipaddr.
xargs
doesn't seem to like the output created by some commands and gives up after the first line. xargs
似乎不喜欢某些命令创建的输出并在第一行之后放弃。 ie: 即:
sed 's/^/csf -d /' hacks >>hacks.sh
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.