# grep "请求报文:" application-20170822-*.log >> applog

# cat applog|cut -d ":" -f2 >> mylog

# cat mylog | while read line ; do mysql -h192.168.55.254 -uceshi -pCeshi123 -e "use mydb;insert into pengcheng (log) values ('$line');" ; done

 

发现当一行的内容过多时,使用  for aa in `cat mylog` ; do ...时,不能读取整行的内容,但是使用 while read line 语句可以实现。

另外,当在linux系统中使用mysql客户端命令时,也要记得修改mysql客户端的字符编码,即 my.cnf 文件添加:

[client]
default-character-set = utf8

 

相关文章:

  • 2021-11-07
  • 2021-07-31
  • 2021-09-03
  • 2021-05-16
  • 2021-12-02
  • 2021-12-15
猜你喜欢
  • 2022-12-23
  • 2021-11-14
  • 2021-12-20
  • 2021-12-25
  • 2021-06-23
  • 2021-08-30
相关资源
相似解决方案