使用sed或其他命令行工具转义CSV文件 [英] Escape CSV file with sed or other command line tool

查看:186
本文介绍了使用sed或其他命令行工具转义CSV文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下CSV,以"|"分隔.

I have the following CSV, separated by "|".

101|abc|this is desc|2017
102|xyz|"thie is a long desc
des for xyz continue here."|2017

我有两个记录,101102. 102条记录分为2行.如何使用sed或其他命令行工具用"/"转义换行符?

I have two records, 101 and 102. 102 record is divided into 2 lines. How can I used sed or other command line tools to escape the new line character with "/"?

推荐答案

$ sed '/102/ s#$#/&#' file11
101|abc|this is desc|2017
102|xyz|"thie is a long desc/
des for xyz continue here."|2017

这篇关于使用sed或其他命令行工具转义CSV文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆