# 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

while read line的更多相关文章

  1. ILJMALL project过程中遇到Fragment嵌套问题:IllegalArgumentException: Binary XML file line #23: Duplicate id

    出现场景:当点击"分类"再返回"首页"时,发生error退出   BUG描述:Caused by: java.lang.IllegalArgumentExcep ...

  2. Error on line -1 of document : Premature end of file. Nested exception: Premature end of file.

    启动tomcat, 出现, ( 之前都是好好的... ) [lk ] ERROR [08-12 15:10:02] [main] org.springframework.web.context.Con ...

  3. 关于xml加载提示: Error on line 1 of document : 前言中不允许有内容

    我是在java中做的相关测试, 首先粘贴下报错: 读取xml配置文件:xmls\property.xml org.dom4j.DocumentException: Error on line 1 of ...

  4. Eclipse "Unable to install breakpoint due to missing line number attributes..."

    Eclipse 无法找到 该 断点,原因是编译时,字节码改变了,导致eclipse无法读取对应的行了 1.ANT编译的class Eclipse不认,因为eclipse也会编译class.怎么让它们统 ...

  5. Linix登录报"/etc/profile: line 11: syntax error near unexpected token `$'{\r''"

    同事反馈他在一测试服务器(CentOS Linux release 7.2.1511)上修改了/etc/profile文件后,使用source命令不能生效,让我帮忙看看,结果使用SecureCRT一登 ...

  6. [LeetCode] Line Reflection 直线对称

    Given n points on a 2D plane, find if there is such a line parallel to y-axis that reflect the given ...

  7. [LeetCode] Tenth Line 第十行

    How would you print just the 10th line of a file? For example, assume that file.txt has the followin ...

  8. [LeetCode] Max Points on a Line 共线点个数

    Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. ...

  9. "Installation failed !" in GUI but not in CLI (/usr/bin/winusb: line 78: 18265 Terminated )

    "Installation failed !" in GUI but not in CLI (/usr/bin/winusb: line 78: 18265 Terminated ...

  10. How to build .apk file from command line(转)

    How to build .apk file from command line Created on Wednesday, 29 June 2011 14:32 If you don’t want ...

随机推荐

  1. python:数据类型

    一.数据类型 1.数字int型 主要进行计算 bit_length() 当十进制用二进制表示时,最少使用的位数 a = 13 b = a.bit_length() print (b) 2.布尔值boo ...

  2. [UE4]Lock Always

    创建一个Widget加到视图,指定为鼠标焦点,并显示鼠标 Lock Always:叫鼠标锁定在游戏窗口内.

  3. css一般性

    1. 总差那么几像素!line-height:100%;2. 数据图片,产品图片用img 小图标,logo,修饰网站的图片 用背景3.文字居中 line-height /text-align:cent ...

  4. echarts3更新

    dataRange: { realtime: false, itemHeight: 80, splitNumber:6, borderWidth:1, textStyle: { color: '#33 ...

  5. 命令提示符没办法登录MySQL

    前几天在CMD命令下输入  MYSQL -UROOT -P 一直显示命令无效. 后来想知道原来是要在MYSQL的BIN(安装)目录下才能访问该命令,如果要在其他路径下使用sql命令,那么要配置MYSQ ...

  6. 集群中使用chronyc同步时间

    在集群之中,有些服务器之间的时间需要同步,但并不是所有机器可以直接连外网,这时可以用Chrony工具解决. 解决方法是将其中一台设为时间服务器,然后其它服务器和这台时间服务器同步即可.具体步骤如下: ...

  7. Linux最大线程数限制及当前线程数查询

    常用配置 echo > /proc/sys/kernel/pid_max a) 当前环境生效 ulimit -d unlimited ulimit -m unlimited ulimit -s ...

  8. Nginx80端口转发+域名——实现IP+端口隐藏

    一.目的1.相信大家会遇到这样的问题:当一台服务器部署多个tomcat应用时,当我们访问tomcat时,需要在浏览器中输入服务器IP+端口号,这看起来非常的low. 二. 环境 1台服务服务器 假如I ...

  9. 数据库导入Excel

    package com.cfets.ts.s.user.rest; import java.io.File; import java.io.FileInputStream; import java.i ...

  10. WPF 获取文件夹路径,目录路径,复制文件,选择下载文件夹/目录

    private void Border_MouseLeftButtonUp_4(object sender, MouseButtonEventArgs e) { //获取项目中文件 , System. ...