unix - 如何在 UNIX shell 脚本中将长数据库字符串拆分为多行?
问题描述
我将以下字符串存储在我的数据库列中:
"Your ack was rejected due to the following reason: \n -- Invalid code received. \n \n Please correct the error and resend."
\n
是我要在其中拆分行的新行字符。
预期输出:
"Your ack was rejected due to the following reason:
-- Invalid code received.
Please correct the error and resend it."
请建议 unix/sed 命令
解决方案
echo $STRING| sed 's/\\n/\n/g
这行得通!
推荐阅读
- css - CSS 绘制顺序属性的 SVG 问题
- python - 将数据描述符传递给函数
- python - 允许多个客户端监听 ThreadedHTTPServer python 3
- ios - 如何在 Swift 4 中将 2 个布尔值组合在一起
- javascript - 如何为foreach循环中的每个数据打开一个带有按钮的模式?
- django - 如何在模板Django中增加变量
- java - Spring - FlatFileItemReader 与 FixedLengthTokenizer 的使用
- c++ - 对内部类的静态实例的未定义引用
- c# - 抽象类构造函数
- java - 如何将其出现的参数设置为 jdbcTemplate 查询函数?