Search code examples
excelnotepad++line-breakscarriage-returnultraedit

Is there a way to split a large text stream into 550 character sections?


I currently am working on a file that is 3,430,900 characters long all in one string. I need to break/split this text string into 550 character segments so there is one 550 segment per line. Each segment is fairly standard but unfortunately there isn't a unique character or sequence that I could use "find and replace" to add a carriage return or line break.

This is a follow up to a question I asked a few days ago, which I did get a great answer to. But now I'm am running into Excel's 32,767 characters per cell limitations. I'm thinking that I may need to use something other than Excel. I have notepad++ and Ultra Edit but not sure if they are able to preform this action.

I can use the below formula with files smaller than 32,767 characters

=MID(Sheet1!$A$1,(ROW(1:1)-1)*550+1,550)

but anything bigger and excel automatically splits the file after the 32,767th character.

Ideally i would like to get a .txt file that has one 550 character record per line that i can bring into Excel for further processing.

Any help would be greatly appreciated!


Solution

  • You may try the following find and replace in Notepad++, in regex mode:

    Find:    .{550}
    Replace: $0\r\n
    

    This will find each 550 characters and replace with the same 550 characters followed by a newline (I used Windows newline \r\n, but if you are on Linux you may just use \n).