while read line
# 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的更多相关文章
- ILJMALL project过程中遇到Fragment嵌套问题:IllegalArgumentException: Binary XML file line #23: Duplicate id
出现场景:当点击"分类"再返回"首页"时,发生error退出 BUG描述:Caused by: java.lang.IllegalArgumentExcep ...
- 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 ...
- 关于xml加载提示: Error on line 1 of document : 前言中不允许有内容
我是在java中做的相关测试, 首先粘贴下报错: 读取xml配置文件:xmls\property.xml org.dom4j.DocumentException: Error on line 1 of ...
- Eclipse "Unable to install breakpoint due to missing line number attributes..."
Eclipse 无法找到 该 断点,原因是编译时,字节码改变了,导致eclipse无法读取对应的行了 1.ANT编译的class Eclipse不认,因为eclipse也会编译class.怎么让它们统 ...
- Linix登录报"/etc/profile: line 11: syntax error near unexpected token `$'{\r''"
同事反馈他在一测试服务器(CentOS Linux release 7.2.1511)上修改了/etc/profile文件后,使用source命令不能生效,让我帮忙看看,结果使用SecureCRT一登 ...
- [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 ...
- [LeetCode] Tenth Line 第十行
How would you print just the 10th line of a file? For example, assume that file.txt has the followin ...
- [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. ...
- "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 ...
- 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 ...
随机推荐
- [UE4]GameInstance初始化
GameInstance的生命周期跟游戏进程一样. 每一次进入游戏都会初始化一个GameInstance,直到退出游戏才会被销毁. 不会随着场景的变化而被销毁.
- MVC 访问静态页面 View 下面放JS
http://blog.csdn.net/qq_17255515/article/details/53293120
- C# webbrowser全掌握(二)
全篇引用单元mshtml; 路径:C:\windows\assembly\GAC\Microsoft.mshtml\7.0.3300.0__b03f5f7f11d50a3a\Microsoft.msh ...
- Markdown画各种图表
并不是所有编辑器都支持,比如博客园这个就不支持... 流程图 st=>start: 开始 op=>operation: 首先按个按钮 op2=>operation: 那你从头开始吧 ...
- AS导入项目报错:Plugin with id 'com.android.application' not found.
从github或第三方Demo中获取的项目导入到AndroidStudio中报错Plugin with id 'com.android.application' not found.:今天导入一个讯飞 ...
- solr 请求参数过长报错,Solr配置maxBooleanClauses属性不生效原因分析
博客分类: 上次已经写过一篇关于solr中,查询条件过多的异常的文章,这次在总结扩展一下: 有时候我们的查询条件会非常多,由于solr的booleanquery默认设置的条件数为1024,所以超过 ...
- 解决Mac下idea运行速度慢
刚入手Mac,发现Mac下使用idea进行调试极其慢,然后发现和本地回环地址有关: 只需稍微修改hosts文件即可: sudo vim /etc/hosts,在localhost后面追加你的电脑名.l ...
- mybatis基于注解形式的多数据源
最近在做一个系统管理项目,需要使用到多数据源,尝试了注解形式和xml形式的多数据源配置,以下是基于注解形式的Mybatis多数据源配置. 1.application.yml 配置文件 database ...
- 查看Selinux和关闭Selinux
查看Selinux和关闭Selinux 注:本文非原创文章,转自以下: 链接:https://www.jianshu.com/p/a7900dbf893c 查看SELinux状态: /usr/sb ...
- 使用Eclipse编译运行MapReduce程序 Hadoop2.6.0_Ubuntu/CentOS
使用Eclipse编译运行MapReduce程序 Hadoop2.6.0_Ubuntu/CentOS 2014-10-10 (updated: 2016-05-22) 64246 153 本教程介绍 ...