Skip to content

Instantly share code, notes, and snippets.

View sunwjblog's full-sized avatar
😝

sunwjcoder sunwjblog

😝
  • GuangZhou
View GitHub Profile
@sunwjblog
sunwjblog / mysql数据库的(增删改查).sh
Created December 27, 2020 06:02
传递参数 实现mysql数据的增删改查
#!/bin/bash
#
user="root"
passwd="1992Sunwj@"
db_name="$1"
SQL="$2"
mysql -u"$user" -p"$passwd" -D "$db_name" -B -e "$SQL"
@sunwjblog
sunwjblog / db_log4.awk.txt
Created December 26, 2020 03:50
在例子3的基础上,加上结尾,统计全部插入记录数,成功记录数,失败记录数
BEGIN{
printf "%-10s%-20s%-20s%-20s\n","User","Tatol","Success","Failed"
}
{
TATOL[$6]+=$8
SUCCESS[$6]+=$14
FALL[$6]+=$18
}
END{
for(u in SUCCESS)
@sunwjblog
sunwjblog / db_log3.awk.txt
Created December 26, 2020 03:50
将例子1和例子2结合起来,一起输出,输出每个人分别插入多少数据,多少成功,多少失败,并且格式化输出,加上标题
BEGIN{
printf "%-10s%-20s%-20s%-20s\n","User","Tatol","Success","Failed"
}
{
TATOL[$6]+=$8
SUCCESS[$6]+=$14
FALL[$6]+=$18
}
END{
for(u in SUCCESS)
@sunwjblog
sunwjblog / db_log2.awk.txt
Created December 26, 2020 03:49
统计每个人分别插入成功了多少record,失败了多少record
BEGIN{
printf "%-10s%-20s%-20s\n","User","Success_Records","Failed_Records"
}
{
SUCCESS[$6]+=$14
FALL[$6]+=$18
}
END{
for(u in SUCCESS)
printf "%-10s%-20d%-20d\n",u,SUCCESS[u],FALL[u]
@sunwjblog
sunwjblog / db_log1.awk.txt
Created December 26, 2020 03:49
统计每个人员分别插入了多少条record进数据库
BEGIN{
printf "%-10s%-10s\n","User","Total Records"
}
{
USER[$6]+=$8
}
END{
for(u in USER)
@sunwjblog
sunwjblog / insert.sh
Created December 26, 2020 03:49
随机生成日志文件脚本 练习awk编程用
#!/bin/bash
# 随机生成日志文件脚本 练习awk编程用
function create_random()
{
min=$1
max=$(($2-$min+1))
num=$(date +$s%N)
echo $(($num%$max+$min))
}
#!/bin/bash
#
#开发分支路径
DEV_DICTIONARY='/Users/sunwj/Documents/myjob/asiainfo/svn/coderep/'
#uat分支路径
BRANCH_DICTIONARY='/Users/sunwj/Documents/myjob/asiainfo/svn/branch/'
#获取
import paramiko # 用于调用scp命令
from scp import SCPClient
import sys
# 将指定目录的图片文件上传到服务器指定目录
# remote_path远程服务器目录
# file_path本地文件夹路径
def upload_file(img_name, remote_path, file_path):
host = "221.179.xxx.xxx" #服务器ip地址
port = 0000 # 端口号
import paramiko # 用于调用scp命令
from scp import SCPClient
import sys
# 将指定目录的图片文件上传到服务器指定目录
# remote_path远程服务器目录
# file_path本地文件夹路径
def upload_file(file_name, remote_path, file_path):
host = "221.179.xxx.xxx" #服务器ip地址
port = 0000 # 端口号
@sunwjblog
sunwjblog / 操作mysql数据库.py
Created December 24, 2020 09:35
操作mysql数据库增删改查
#!/usr/bin/env python
# coding=utf-8
import pymysql
def connectdb():
print('连接到mysql服务器...')
# 打开数据库连接
# 用户名:root, 密码:1992Sunwj@,用户名和密码需要改成你自己的mysql用户名和密码,并且要创建数据库asiainfo,并在asiainfo数据库中创建好表Jobinfo