'for' and 'sed' command

sed -e '/^sshd/!d' hosts.deny | cut -d' ' -f2
-e '/^sshd/!d' 删除非‘sshd’开头的行
-d' '  空格分隔
-f2 分隔后所得数组的第二个值
引用
$ cat hosts.deny
sshd: 117.21.249.75
sshd: 58.252.146.187
sshd: 217.111.0.6
sshd: 92.243.65.138

for i in $(sed -e '/^sshd/!d' hosts.deny | cut -d' ' -f2); do echo $i;done
for i in $(sed -e '/^sshd/!d' hosts.deny | cut -d' ' -f2); do /home/mg/Downloads/hostDeny/pyip.py $i;done

你可能感兴趣的:(for sed)