0

I have a notepad++ file containing tens of thousands of lines.

Each entry in my import program must have each field separated by a delimiter. When bringing the information over into notepad++ I have an issue where it detects carriage returns from excel and places them into the text which the import program won't read.

I am positive that each row has fields separated by commas, these fields have no character limit, and the only field that is a constant is the first field (date).

Each line in notepad++ needs to look like this

Date,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,AB,AC,AD,AE,AF

However, something in the copy paste over is causing these fields to insert carriage returns

I.e. Date, A,

B, C, D,

E, F, G, H, I, J etc.

Unfortunately there is not a line that is always affected in each case.

Is there anyway, rule, that will draw each of these up so that all lines that start with a date will be joined with the lines below it until there occurs another date?

3
  • Please edit and include some sample text ...
    – DavidPostill
    Jun 21, 2016 at 17:20
  • @guest I'd rather have some proper data to work with ...
    – DavidPostill
    Jun 21, 2016 at 17:27
  • if your DATE is always fixed length then you can do this in 2 steps, first remove all CR/LF from your text: find \r\n replace with nothing (using regexp replace option) then search for ([0-9][0-9]/[0-9][0-9]/[0-9][0-9][0-9][0-9]) and replace with \r\n\1 (using REGEXP REPLACE)
    – arana
    Jun 21, 2016 at 18:45

1 Answer 1

0

If your csv file is exported from excel, an easier way is Find and Replace Line Break with Space then export again.

If you have no access to original excel, then in notepad++ replaces in extended search mode \r\n to \r then \n to space then \r back to \r\n.

The reason it works is excel delimits row with \r\n. Single \n must have originated from cell data.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .