s :取代,可以直接进行取代的工作哩!通常这个 s 的动作可以搭配正规表示法!例如 1,20s/old/new/g 就是啦!
1 2 3 4
# 给/bin/setclasspath.sh添加配置 sed -i '21a\export JAVA_HOME='$JAVA_HOME $setclasspath && sed -i '22a\export JAVA_HOME='$JAVA_HOME/jre $setclasspath
1 2 3 4 5 6
$ sed -e 4a\newline testfile #使用sed 在第四行后添加新字符串 HELLO LINUX! #testfile文件原有的内容 Linux is a free unix-type opterating system. This is a linux testfile! Linux test newline
在linux上输入man ping,可以查看ping命令的参数,其中-w的意思是: -w deadline Specify a timeout, in seconds, before ping exits regardless of how many packets have been sent or received. In this case ping does not stop after count packet are sent, it waits either for deadline expire or until count probes are answered or for some error notification from network. 亲自测试的意思就是:w代表着超时时间,像 ping -w 5 www.baidu.com ,意思就是只ping5秒,5秒后命令结束。