shell
lfwer
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
shell数据遍历
#/bin/sh 定义数据 ary=('item0' 'item1' 'item2') v='item0' white1=(1 2) white2=(11 22) #判断ary数组中是否包含v if echo "${ary[@]}" | grep -w "${v}" then echo "yes" else echo "no&原创 2018-11-12 10:58:23 · 1053 阅读 · 0 评论 -
shell 字符串转数组
test.sh脚本如下: apps="${1}" #按“T”分隔 arr=(${apps//T/ }) for app in ${arr[@]} do apps2="${app}" #按“,”分隔 arr2=(${apps2//,/ }) for app2 in ${arr2[@]} do echo "${app2}" done do...原创 2018-07-06 13:59:01 · 1015 阅读 · 0 评论 -
shell脚本导出mysql数据库数据到文件
/usr/bin/mysql -uroot -p******** -h******** statistics -A --default-character-set=utf8 -N -e "SELECT trim(',' from t2.white_user_group_ids),t.scene_id,t.exposure_pv FROM v_scene_statistics t LEFT JOI...原创 2018-07-02 18:16:25 · 3890 阅读 · 0 评论 -
shell脚本统计文件行数并取出10%
#!/bin/sh c=0 c=`sed -n '$=' test.txt` let c=$c/10 echo $c原创 2018-06-25 19:02:18 · 297 阅读 · 0 评论 -
shell 常用命令
查找1.txt中出现2.txt里的文字的结果输出到final.txt awk 'NR==FNR{a[$1];next}{s=substr($0,5);if((s in a)){print substr($0,1,11)}}' 1.txt 2.txt>final.txt 取两个文件的交集 grep -F -f a.txt b.txt | sort | uniq ...原创 2018-06-22 15:29:40 · 132 阅读 · 0 评论 -
shell脚本循环遍历目录文件并通过curl进行上传
#!/bin/sh #待上传文件目录 upload_dirName="/home/operationPhone/upload/" #上传完毕后备份目录 complete_dirName="/home/operationPhone/complete/" #日志目录 log_dirName=“/var/log/” #当前日期 currentDate=`date +%Y-%m-%...原创 2018-06-21 16:35:00 · 1765 阅读 · 0 评论 -
编写shell脚本通过ftp下载文件并进行合并去重操作
#!/bin/bash today_date=`date +%Y%m%d` now=`date +'%Y-%m-%d %H:%M:%S'` echo "===================================${now}脚本开始执行=====================================" >> /home/shell/log/dat...原创 2018-06-21 14:38:12 · 943 阅读 · 0 评论 -
编写shell脚本通过ftp下载文件并进行合并去重操作
#!/bin/bash today_date=`date +%Y%m%d` now=`date +'%Y-%m-%d %H:%M:%S'` echo "===================================${now}脚本开始执行=====================================" >> /home/shell/log/data...原创 2019-01-17 17:53:34 · 343 阅读 · 0 评论 -
shell脚本循环遍历目录文件并通过curl进行上传
#!/bin/sh #待上传文件目录 upload_dirName="/home/operationPhone/upload/" #上传完毕后备份目录 complete_dirName="/home/operationPhone/complete/" #日志目录 log_dirName=“/var/log/” #当前日期 currentDate=`date +%Y-%m-%d...原创 2019-01-17 17:53:40 · 2038 阅读 · 0 评论 -
shell 常用命令
查找1.txt中出现2.txt里的文字的结果输出到final.txt awk ‘NR==FNR{a[$1];next}{s=substr($0,5);if((s in a)){print substr($0,1,11)}}’ 1.txt 2.txt>final.txt 取两个文件的交集 grep -F -f a.txt b.txt | sort | uniq 删除一周前的文件 find /h...转载 2019-01-17 17:54:09 · 912 阅读 · 0 评论 -
shell脚本统计文件行数并取出10%
#!/bin/sh c=0 c=sed -n '$=' test.txt let c=$c/10 echo $c原创 2019-01-17 17:54:33 · 548 阅读 · 0 评论 -
shell脚本导出mysql数据库数据到文件
/usr/bin/mysql -uroot -p******** -h******** table_name -A --default-character-set=utf8 -N -e “SELECT 1 FROM dual” > /tmp/date +%Y%m%d -d -1day.txt -A 取消检查 -N 不输出列头 -e sql语句 ...原创 2018-11-12 14:18:52 · 3909 阅读 · 0 评论 -
shell 字符串转数组
test.sh脚本如下: apps="${1}" #按“T”分隔 arr=(${apps//T/ }) for app in ${arr[@]} do apps2="${app}" #按“,”分隔 arr2=(${apps2//,/ }) for app2 in ${arr2[@]} do echo "${app2}" ..原创 2018-11-12 10:57:46 · 7390 阅读 · 0 评论 -
shell数据遍历
#/bin/sh 定义数据 ary=('item0' 'item1' 'item2') v='item0' white1=(1 2) white2=(11 22) #判断ary数组中是否包含v if echo "${ary[@]}" | grep -w "${v}" then echo "yes" else echo "no" fi ...原创 2018-07-13 18:57:31 · 1184 阅读 · 0 评论
分享