How would one go about using sed in order to insert
如何使用sed进行插入
rm -rf
at the start of each line of a file?
在文件的每一行的开头?
2 个解决方案
#1
39
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
#2
0
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. ie:
xargs似乎不喜欢某些命令创建的输出并在第一行之后放弃。即:
sed 's/^/csf -d /' hacks >>hacks.sh
#1
39
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
#2
0
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. ie:
xargs似乎不喜欢某些命令创建的输出并在第一行之后放弃。即:
sed 's/^/csf -d /' hacks >>hacks.sh