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 ...
随机推荐
- MaidSafe区块链项目白皮书解读
MaidSafe.net宣布项目SAFE到社区 1. 介绍 现有的互联网基础设施越来越难以应付超过24亿互联网用户的需求,这个数字在2017年预计将增长到36亿.今天的架构中,中央中介(服务器)存储并 ...
- vue 绑定属性 绑定Class 绑定style
<template> <div id="app"> <h2>{{msg}}</h2> <br> <div v-bi ...
- sas 日期比较代码备忘
DATA A; SET S.payrecordinfo; YY=DATEPART(AddTime); FORMAT YY MMDDYY10.;RUN; DATA A1; SET ...
- flask表单标签
环境:python2.7+flask+flask_wtf 内容:flask的部分常用表单标签 test.py # -*- coding: utf-8 -*- # flask web_form 表单控件 ...
- TP5实现邮件发送(PHP 利用QQ邮箱发送邮件「PHPMailer」)
在 PHP 应用开发中,往往需要验证用户邮箱.发送消息通知,而使用 PHP 内置的 mail() 函数,则需要邮件系统的支持. 如果熟悉 IMAP/SMTP 协议,结合 Socket 功能就可以编写邮 ...
- python- 日志学习
# @File : learn_logging.py #-*- coding:utf-8 -*- """ 日志:log 记录代码执行的过程 一旦记录下来,就可以根据日志去 ...
- <spark> hadoop/spark 集群搭建
参考的这3个文档,虽然搭建花了挺长时间也遇到挺多问题,但是这3个文档对我的帮助确实挺大,如果有兴趣的或者有需要的可以参考以下文档. http://blog.csdn.net/wy250229163/a ...
- CopyOnWriteList-JDK1.8
CopyOnWrite,一个写时复制的技术来保证并发操作的安全,使用这种技术的前提是读大于写. 读读之间相容, 写写之间互斥, 读写操作相容. 实现方法: 在对底层数据进行写的时候,把底层数据复制一份 ...
- ELK学习博客
ELK实时日志分析平台环境部署--完整记录 https://www.cnblogs.com/kevingrace/p/5919021.html
- Tomcat 之session 持久化1
Tomcat 之session 持久化原理 几个概念: Manager 接口,其实就是指的是对 其Sesison 的管理, 其默认实现是StandardManager (内部没有任何Store对象实 ...