Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在MySQL CLI中以明文形式打印转义字符_Mysql - Fatal编程技术网

在MySQL CLI中以明文形式打印转义字符

在MySQL CLI中以明文形式打印转义字符,mysql,Mysql,我有一个MySQL表,它的行中可能包含转义字符,例如,我的csv_line_terminator字段具有值,例如'\n'、'\r\n'等 这使得调试变得困难,因为MySQL CLI解释实际值: mysql> select id,csv_line_terminator from feed_feed; +----+---------------------+ | id | csv_line_terminator | +----+---------------------+ | 1 | NUL

我有一个MySQL表,它的行中可能包含转义字符,例如,我的csv_line_terminator字段具有值,例如'\n'、'\r\n'等

这使得调试变得困难,因为MySQL CLI解释实际值:

mysql> select id,csv_line_terminator from feed_feed;
+----+---------------------+
| id | csv_line_terminator |
+----+---------------------+
|  1 | NULL                |
|  2 | NULL                |
|  3 | NULL                |
|  4 | 
              |
+----+---------------------+
4 rows in set (0.01 sec)
我想把它打印出来:

mysql> select id,csv_line_terminator from feed_feed;
+----+---------------------+
| id | csv_line_terminator |
+----+---------------------+
|  1 | NULL                |
|  2 | NULL                |
|  3 | NULL                |
|  4 | \r\n                |
+----+---------------------+
4 rows in set (0.01 sec)

MySQL CLI中是否有设置或其他内容来替代此行为?

我认为您可以使用
PAGER
命令自定义输出,如所述。 困难在于找到一个基本命令,将端点字符转换为它们的视觉表示。 一个棘手的方法是创建一个php或python脚本(或其他语言)并将其传递给pager

在php脚本中


$argv=$_服务器['argv'];
$argc=$\服务器['argc'];
如果($argc>1){
str_replace(“/n”、“/n”、$argv[1]);
str_replace(“/r”、“/r”、$argv[1]);
str_替换(“/t”、“/t”、$argv[1]);
}
然后在
.sh
文件中

#!/bin/sh
php yourfile.php
并将寻呼机设置为
pageryourshfil.sh