awk1、打印文件的第一列(域) : awk '{print $1}' filename2、打印文件的前两列(域) : awk '{print $1,$2}' filename3、打印完第一列,然后打印第二列 : awk '{print $1 $2}' filename4、打印文本文件的总行数...
分类:
系统相关 时间:
2014-10-14 20:19:59
阅读次数:
201
原始文件的内容:代码如下:[root@localhost ~]# cat file.txthello worlda:b:c -h -na:b:c -h -nsed根据条件删除相关的行:代码如下:[root@localhost ~]# sed -i '/a:b:c -h -n/d' file.txt[...
分类:
系统相关 时间:
2014-10-14 13:19:58
阅读次数:
192
1.sed -f xx.sed input_file可以将一系列操作放在一个xx.sed脚本里执行```#!/bin/sed -f```2.在匹配字符串后面或行尾添加内容在text后面添加content: sed 's/text/& content/g' input_file在行尾添加content...
分类:
其他好文 时间:
2014-10-13 12:42:49
阅读次数:
173
####closeserviceTimeServerMaster="192.168.6.13"SSHPort="58522"echored(){echo-ne"\033[31m"$1"\033[0m\n"}echogreen(){echo-ne"\033[32m"$1"\033[0m\n"}IPN=`ifconfig|grep192.168|awk‘{print$2}‘|cut-d:-f2|awk-F.‘{print$3"-"$4}‘`HOSTNAME="HK$IPN"hostname$HOSTNAMEsed..
分类:
其他好文 时间:
2014-10-13 02:47:49
阅读次数:
404
LOAD MORELOREM IPSUM DOLORQuisque posurer risus erat at scelerisque felis pulvinar quis.Maecenas arcu lorem,laoreet at dui in,hendrerit mattis mi.Sed ...
分类:
其他好文 时间:
2014-10-12 19:28:38
阅读次数:
209
[ sed简单介绍:]sed是一个非常好的文件处理工具, 它本身是一个管道命令, 以行为单位进行处理, 能够用于对数据行进行新增、选取、替换、删除等操作。sed命令行格式:sed [-nefri] 'range command' file如: sed '2d' aaa.txt ...
分类:
系统相关 时间:
2014-10-12 16:20:30
阅读次数:
263
#!/bin/sh
# Find ip
IP=`/sbin/ifconfig eth1 | grep 'inet addr' | awk '{ print substr($2, index($2, ":")+1)}'`
#monitor procname scriptname
monitor()
{
procname=$1
scriptname=$2
# Find proc by p...
分类:
Web程序 时间:
2014-10-12 10:46:07
阅读次数:
267
生成~/.dircolors dircolors?-p?>?~/.dircolors 鉴于蓝色在terminator很难看,修改目录颜色和777文件夹颜色: sed?-ie?‘s/DIR?01;34/DIR?01;33/g‘?~/.dircolors
sed?-ie?‘s/OTHER_WRITABLE?34;42/OTHER...
分类:
系统相关 时间:
2014-10-12 08:48:58
阅读次数:
213
#!/bin/sh
my_ip=`/sbin/ifconfig eth1 | grep 'inet addr' | awk '{print substr($2, index($2, ":")+1)}'`
recv=""
msg="not_existing, restart ..."
MONITOR_LOG="monitor.log"
#monitor procname scriptname...
分类:
系统相关 时间:
2014-10-11 23:25:07
阅读次数:
329
内容提要1. 第一难度, 重要 梯队 (grep, awk, sed, find, )2. 第二常用, 重要 梯队 (ps, ls, date, fuser, netstat, kill)3. 第三 特殊用途 梯队 (压缩打包, 背景运行, 工作例程, 性能监控, 安装包)4. 正则表达式一. 难度...
分类:
系统相关 时间:
2014-10-11 17:22:45
阅读次数:
226