Remove or replace LF from CSV file
Asked Answered
C

3

6

I have some huge CSV files where sometimes the lines end with LF instead of CRLF, for example:

pippo LF
pluto CRLF

I want to convert these two lines into a single line, like pippo pluto CRLF.

I'm trying to do this in Notepad++ (Windows 7), but I'm not able to do it...

Christiano answered 19/9, 2013 at 7:37 Comment(1)
So you don't want to replace all occurrences of LF with CRLF? – Instead, do you want to remove all occurrences of LF? (If I misunderstood you, my edit is wrong.)Sarcous
C
10

To do so:

Ctrl + F
Go to the "Replace" tab
In "Find What" paste: ([^\r])\n
In "Replace with" paste: \1
Choose "Regular expression" in "Search Mode"
Click "Replace All"
Coarctate answered 3/12, 2014 at 12:43 Comment(0)
A
4

In "Edit" menu, choose "Convert line feed" and "Convert to windows format (CRLF).

NB: I'm not quite sure of the labels because I have not an english version of Notepad++.

Notepad++ menus evolve from version to version. In the English version of Notepad++ 6.3.2 from the Edit menu, select EOL Conversions => Windows Format.

Atheroma answered 19/9, 2013 at 7:48 Comment(0)
F
1

Just replace all the \r with "".

To do so:

  1. Ctrl+F
  2. Go to "Reaplace" tab
  3. In "Find What" paste: \r
  4. In "Replace with" paste: ""
  5. Choose "Extended" in "Search Mode"
  6. Replace All
Furtado answered 19/9, 2013 at 7:40 Comment(1)
Hi, I solved using a trick: Replace \n with null, and after that replace \r with \r\n. ThanksChristiano

© 2022 - 2024 — McMap. All rights reserved.