shell
robert_zhai
Life is short, cherish what we have owned !
My github is https://robertzhai.github.io 。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
两文件内容差
for i in `cat 2.txt` do sed -i "/$i/d" 1.txt done comm,grep也可以转载 2012-12-27 16:51:01 · 333 阅读 · 0 评论 -
Mac git amend There was a problem with the editor 'vi'.
$git ci -a --amend 提示 error: There was a problem with the editor 'vi'. Please supply the message using either -m or -F option. solution: git config --global core.editor /usr/bin/vim原创 2016-11-03 11:36:19 · 1511 阅读 · 0 评论 -
find 指定不在某个目录下查找
find /search -path /search/aaa -prune -o -name "*.txt" -print find /search \( -path /search/aaa -o -path /search/bbb \) -prune -o -name "*.txt" -print原创 2013-11-29 23:25:32 · 757 阅读 · 0 评论 -
shell 批量打包
#! /bin/bash for dir in `ls -l|grep ^- |awk '{print $9}'` do tar zcvf $dir.tar.gz $dir done原创 2013-11-28 14:41:25 · 953 阅读 · 0 评论 -
linux grep 匹配某行不以800开头
cat file | grep '^[^800]'原创 2013-09-25 10:33:52 · 3315 阅读 · 0 评论 -
awk 文本格式化
黎明,1233 =》 {"name":"黎明1233"}, cat staff.sort | awk -F',' '{print "{""\"""name""\""":""\"" $1 ""$2 "\"""}," }'原创 2013-01-14 14:33:36 · 290 阅读 · 0 评论 -
shell 通讯录(4)
#!/bin/bash #libCom.sh 公用shell 库 # print warning # args:$@->message to print printWARNING(){ echo "WARNING:" $@ >&2 } printERROR() { echo "error :" $@ >&2 } # print usage # args:原创 2012-12-21 08:35:59 · 706 阅读 · 0 评论 -
shell 通讯录(1)
#!/bin/bash #showperson #show matching records in addressbook #args:$1->string to look for in addressbook PATH=/bin:/usr/bin if [ $# -lt 1 ];then echo "USAGE:./showperson name" exit原创 2012-12-21 08:31:31 · 1034 阅读 · 0 评论 -
shell通讯录(2)
#!/bin/bash # addperson # args -n name # -e email # -a postal address # -p phone number #initialize the variables PATH=/bin:/usr/bin MYADDRESSBOOK="/home/addressbook/address原创 2012-12-21 08:33:31 · 742 阅读 · 0 评论 -
shell通讯录(3)
#!/bin/bash # delperson # del a person from addressbook # args:$1-> name of person to delete #get the helper function . /home/addressbook/libComm.sh PATH=/bin:/usr/bin if [ $# -lt 1 ];原创 2012-12-21 08:34:51 · 507 阅读 · 0 评论 -
ip count
1. ip.sh BEGIN{ #print "start counting ip"; {ip[$1]++; } END{ for(i in ip){ print ip[i]," ", i } } awk -f ip.sh ip.txt | sort -rn -k 1 2 129.0.0.1 2 128.0.0.1原创 2012-12-30 10:18:10 · 433 阅读 · 0 评论 -
expect 实现 自动打包和提交代码到github
问题:web项目用gulp压缩处理之后,提交到github 需要2次执行命令,想把这个流程合并 解决:expect交互式命令提交 build_push.sh #!/usr/bin/bash gulp rsync -avr build/* . git add * git ci -am 'update this repo' echo "start push .." expect ~/.acc原创 2016-11-13 18:03:28 · 1248 阅读 · 0 评论
分享