ifconfig bro |grep inet |grep inet6 -v |awk -F " " '{PRINT $2}' #########sort&&uniq用法######## sort -n file ##按数值排列 -rn file ##倒序 -rnu file ##去除重复并倒序排列 -rn file ## sort -rn file | uniq -c sort -rn file | uniq -d sort -rn file | uniq -n sort -rn file | uniq -u ps ax -o pid --sort -%mem |grep -v PID|head -n 5 #########sed####################### sed 's/原字符/替换字符/g' file sed -e '策略1' -e '策略2' file sed -i file ##把转换后的内容输出到指定文件 sed '3,5s/原字符/替换字符/g' file sed 5x passwd 5d 5p -n 3,5p -ne 3p -ne 5p crate_user /mnt/userfile /mnt/passwdfile [root@foundation8 mnt]# cat create_user.sh #!/bin/bash MAX_LINE=`wc -l $1 |awk -F " " '{print $1}'` for NUM in `seq 1 $MAX_LINE` do USERNAME=`sed -n ${NUM}p $1` PASSWORD=`sed -n ${NUM}p $2` useradd $USERNAME echo $PASSWORD|passwd --stdin $USERNAME done