zoukankan      html  css  js  c++  java
  • Linux-练习-取IP

    1.grep :ifconfig eth0 | grep -o '^[^6]* addr:[0-9.]*' | grep -o [0-9.]*

    2.sed :ifconfig eth0 | sed -nr 's#^.*dr:(.*)  B.*$#1#g'p

    3.sed :ifconfig eth0 | sed -nr "/^.*dr:(.*)  B.*/s##1#"p

    4:awk :ifconfig eth0 | awk -F '[ :]+' 'NR==2{print $4}'

    5:ifconfig eth0 |awk '/addr:[[:digit:]]/''{print $2}' |sed 's/addr://g'

    -------------------- 阑心而慧智,心静而致远. --------------------
  • 相关阅读:
    Docker
    Docker
    VIM
    Python
    Python
    VIM
    Python
    其他
    Java
    Java
  • 原文地址:https://www.cnblogs.com/mirrorlake/p/7407356.html
Copyright © 2011-2022 走看看