awk用法:awk‘pattern{action}‘变量名 含义ARGC 命令行变元个数ARGV 命令行变元数组FILENAME 当前输入文件名FNR 当前文件中的记录号FS 输入域分隔符,默认为一个空格RS 输入记录分隔符NF 当前记录里域个数NR 到目前为止记录数OFS 输出域分隔符ORS 输出记录分隔符1、awk‘/101/‘f..
分类:
其他好文 时间:
2015-05-20 15:07:19
阅读次数:
119
代码如下:awk '{if(2==NR){gsub(/.*/, 300, $5)}print}' list.txt将文件list.txt的第2行第5列的值替换为300
分类:
其他好文 时间:
2015-05-18 12:46:11
阅读次数:
325
摘自POLARSSL 1 #pragma once 2 3 #define AES_ENCRYPT 1 4 #define AES_DECRYPT 0 5 6 struct aes_context 7 { 8 int nr; /*!...
分类:
其他好文 时间:
2015-05-15 21:19:42
阅读次数:
1047
1 class TrieNode { 2 public: 3 const static int NR_FANOUT = 26; 4 TrieNode* child[NR_FANOUT]; 5 int count; 6 // Initialize your data ...
分类:
其他好文 时间:
2015-05-11 23:55:30
阅读次数:
191
最近帮同学写一个简单脚本==(别喷我~~),状况频出,后台运行方式和ctrl+Z概念没有理解清楚搞出了大笑话,一下晾出脚本和解决过程:#!/bin/bash
while:;do
a=`date+%Y/%m%d%T`
java=`psaux|grepvsftpd|awk‘NR==1{print$3}‘`
echo"时间$a,CPU使用率$java">>xiangchen/1.t..
分类:
系统相关 时间:
2015-05-08 18:28:23
阅读次数:
136
#!/bin/bash
#autodropsshfailedIPaddress
#bycolinkon2015-05-07
IPTAB_DIR=‘/etc/sysconfig/iptables‘
LOG_DIR=‘/var/log/secure‘
IPADDRS=`tail-n200${LOG_DIR}|grep"Failedpassword"|grep-Eo‘([0-9]{1,3}\.){3}[0-9]{1,3}‘|sort-nr|uniq-c|awk‘$1>=5{print$2}‘`
echo-e..
分类:
其他好文 时间:
2015-05-08 01:52:56
阅读次数:
153
1.awk '{print substr($1,1,4)}'2.不要第一行 awk 'NR!=1{print $0}'3.获取后缀名ls |tov|cut -d "." -f24.减法start=`expr ${start1} - 1`end=`expr ${end1} - ${start}`5.去...
分类:
系统相关 时间:
2015-05-07 08:43:39
阅读次数:
137
# hostname (主机名)# hostid# uname -X# uname -a# w (进程)# who# last# ps -eaf# /usr/ucb/ps -aux# prstat# ifconfig -a (IP地址)# netstat -nr# netstat -in# /usr...
分类:
其他好文 时间:
2015-05-06 16:43:23
阅读次数:
143
1 #include 2 #include 3 #include 4 5 int main() 6 { 7 int nR = 1; 8 9 const char as[] = "tencent";10 if ("tencent" == as)11 ...
分类:
其他好文 时间:
2015-05-06 13:04:50
阅读次数:
120
这里先以一个例子简单标记一下,将这个问题抛出,以后再补充完整。bash的解析次序例子:grid@wenge-VirtualBox:~/sh_test$ sudo awk 'NR==1 {print $0}' /etc/shadowroot:!:16141:0:99999:7:::grid@wenge...
分类:
系统相关 时间:
2015-05-04 21:45:11
阅读次数:
131