centos7ifconfigens32|grep"inet"|awk-F‘‘‘NR==1{print$2}‘centos6ifconfigeth0|awk-F‘[:]+‘‘NR==2{print$4}‘
分类:
其他好文 时间:
2017-05-03 19:24:24
阅读次数:
143
shell编程中,awk简直就是一把利器,你能够把它看成shell的一部分,也能够看成一种单独的语言,功能十分强大。今天先来说一说NR与FNR 先准备两个文件: 1.txt,内容为: user password wolf 123456 zys 123 2.txt 内容为: id user 0001 ...
分类:
其他好文 时间:
2017-05-01 12:53:13
阅读次数:
168
扩展为:任意两个无限接循环群总是同构的 如何证明其实单射 其kerφ={0} 反证法:假设其kerφ中还包含有另外一个整数,记作n,满足φ(n)=an=e; 对于G中的任何一个元素am;令m=nr+q;0<q<\n\ 则am=anr+q=anr+aq=aq 则任何一个元素am与都与有限个元素相等,故 ...
分类:
其他好文 时间:
2017-04-30 18:32:50
阅读次数:
341
for循环applist=(app1app2app3);forappin${applist[@]};doecho$app;done;获取IP地址ifconfig|grep-Po‘(?<=addr:).*(?=Bc)‘ifconfig|awk-F"[:]+"‘$4~/[0-9].+[^0-9]+/{print$4}/lo/{exit}‘ifconfig|sed-nr‘s/^[[:space:]]+inetaddr:(.*)Bcast.*/\1/p‘ifconfig|grep-o‘\([1-9]..
分类:
系统相关 时间:
2017-04-24 23:06:21
阅读次数:
189
[root@oldboyC07]#cat7_1.sh#!/bin/bashif[-f/etc/hosts]thenecho"[1]"fiif[[-f/etc/hosts]]thenecho"[[1]]"fiiftest-f/etc/hoststhenecho"test1"fi[root@oldboyC07]#cat7_2.sh#!/bin/bashFreeMem=`free-m|awk‘NR==3{print$NF}‘`CHARS="Currentmemoryis$FreeMem."if[$FreeMem-l..
分类:
系统相关 时间:
2017-04-19 10:29:27
阅读次数:
244
方法1:监控磁盘或CPU超过一定值邮件报警脚本:[root@oldboyscripts]#catcheck.sh#!/bin/bashLANG=en_US.UTF-8cpuUsed=`top-n1|awk-F‘[,%]+‘‘NR==3{print100-$11}‘`diskUsed=$(df-h|awk-F‘[%]+‘‘/\/$/{print$5}‘)logFile=/tmp/jk.logfunctionSendmail(){mail-s"监控报警"1665**..
分类:
系统相关 时间:
2017-04-18 20:14:23
阅读次数:
2184
从前一个和谐的班级,有 nlnl 个是男生,有 nrnr 个是女生。编号分别为 1,…,nl1,…,nl 和 1,…,nr1,…,nr。 有若干个这样的条件:第 vv 个男生和第 uu 个女生愿意结为配偶,且结为配偶后幸福程度为 ww。 请问这个班级里幸福程度之和最大是多少? 输入格式 第一行三个正 ...
分类:
其他好文 时间:
2017-04-14 20:36:47
阅读次数:
207
awk 命令: 1、 打印行号和内容: awk '{print NR":"$0}' 2、 输出:偶数行和奇数行到文件 awk '{print $0.txt > NR%2.txt}' file 3、 打印出奇数行内容:(三者等价) awk 'NR%2==1' file awk 'NR%2' all_f ...
分类:
系统相关 时间:
2017-04-14 16:29:27
阅读次数:
390
1.1环境准备[root@moban~]#cat/etc/redhat-release
CentOSrelease6.5(Final)
[root@moban~]#/etc/init.d/iptablesstop
[root@moban~]#getsebool
getsebool:SELinuxisdisabled
[root@moban~]#ifconfigeth0|awk-F"[:]+"‘NR==2{print$4}‘
192.168.199.101.2server端安装rpm-ihvhtt..
分类:
其他好文 时间:
2017-04-13 15:54:57
阅读次数:
235
#!/bin/bashIP="`ifconfigeth0|awk-F"[:]+"‘NR==2{print$4}‘`_$(date%F%H%M)"通过sh执行脚本正常,通过crontab计划任务调用就是空值,*/1****/bin/sh/scripts/tar.sh>/dev/null2>&1解决方法:把脚本中ifconfig改成全路径/sbin/ifconfig问题解决IP="`/sbin/ifconfiget..
分类:
系统相关 时间:
2017-04-12 10:11:33
阅读次数:
486