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 ...
随机推荐
- win10家庭版怎么开启Administrator超级管理员帐户
一.win10家庭版开启administrator方法: 1.通过Cortana搜索cmd,匹配出“命令提示符”,右键以管理员身份运行: 2.在打开的命令提示符窗口输入net user admin ...
- 本机无法访问虚拟机里面的nginx的80端口
在虚拟机VMware上装好了centos6.9,并配好了nginx,但是本机就是无法访问.具体情况如下1.本机能ping通虚拟机2.虚拟机也能ping通本机3.虚拟机能访问自己的web4.本机无法访问 ...
- plsql怎么执行sql脚本
首先,我们需要登录需要执行sql文件的用户,在我们确保sql文件无误的情况下,进入plsqldeveloper: 1,找到tools--->import tables --->选择sql ...
- 通过注解实现一个简易的Spring mvc框架
1.首先我们来搭建架构,就建一个普通的javaweb项目就OK了,具体目录如下: 对于小白来说可以细看后面web.xml的配置,对javaweb有点研究可以忽略而过后面的web.xml配置. 2.先上 ...
- Blob下载文件 & 模拟滚动条实现
1.vue切换路由视图时,事件钩子顺序是 当前模块create-->上一个模块beforeDestroy-->当前模块mounted 因此注册全局事件(比如给window注册事件)应放在m ...
- [CVE-2014-8959] phpmyadmin任意文件包含漏洞分析
0x01 漏洞描述 phpmyadmin是一款应用非常广泛的mysql数据库管理软件,基于PHP开发. 最新的CVE-2014-8959公告中,提到该程序多个版本存在任意文件包含漏洞,影响版本如下: ...
- (转)利用WPF的ListView进行大数据量异步加载
原文:http://www.cnblogs.com/scy251147/archive/2012/01/08/2305319.html 由于之前利用Winform的ListView进行大数据量加载的时 ...
- mysql中min和max查询优化
mysql max() 函数的需扫描where条件过滤后的所有行: 在测试环境中重现: 测试版本:Server version: 5.1.58-log MySQL Community ...
- linux 乌班图 安装pycharm
1.通过vmware安装ubuntu系统2.安装完成后,登录ubuntu,通过普通用户 s14登录,密码redhat3.下载pycharm到ubuntu系统中 -可以通过python -m http. ...
- linux之 redis 的rdb 转 aof 及主从复
redis持久化RDB基于快照的持久化通过save命令,强制持久化 在redis.conf中dbfilename dbmp.rdbsave 900 1save 300 10save 60 10 ...