只有用引号括起来才能删除换行符
我有一个文本文件中的大量数据,一直给我一些问题。 该文件中的许多logging在logging之间有换行符。 例如,这是我的数据当前的样子:
30670169, Corvette, EL-P078675, EL-P078675, Chevrolet Corvette C6 Color Matching Millenium Yellow License Plate Frame, "Made from high-quality billet aluminum, this stylish license frame is custom painted to precisely match the color of your C6 Corvette. It features an engraved OEM style nameplate. High-gloss finished will never rust. 12"" x 6"" in standard size. Includes color matched screw covers and hardware. This is a special custom made item. It takes 10-15 business days to ship. Brand new official licensed product."
这是如何读取:
30670169, Corvette, EL-P078675, EL-P078675, Chevrolet Corvette C6 Color Matching Millenium Yellow License Plate Frame, "Made from high-quality billet aluminum, this stylish license frame is custom painted to precisely match the color of your C6 Corvette. It features an engraved OEM style nameplate. High-gloss finished will never rust. 12"" x 6"" in standard size. Includes color matched screw covers and hardware. This is a special custom made item. It takes 10-15 business days to ship. Brand new official licensed product."
我需要一个方法来删除换行符,只要它们被引号包围。 有人有主意吗?
尝试使用Notepad ++的查找/replacefunction。
找:
\r(?!\n)
用。。。来代替:
(空间)
您将需要检查正则expression式checkbox:
先尝试用几行代替(例如,select前80行),然后在select中replace以查看。 如果这样的话,你可以继续整个文件。
在上面\r
会匹配一个CR, \n
会匹配一个LF。 (?!\n)
是一个特殊的组,意思是“不符合\r
如果后面跟着\n
”。
注意:我认为记事本++有时不会正确地进行replace,所以如果一次replace整个文件会导致问题,请尝试在较小的批次中进行replace。
我通常使用一个脚本来做这样的事情,但是如果你不习惯的话,我不认为你会准备好使用一个脚本:
您可以在Excel中打开csv文件并删除换行符,如下所示: http : //www.excelblog.ca/remove-line-breaks-from-excel-cell/
你也可以在一个特定的列上进行。