Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Can I Insert A Carriage Return Linefeed Every X Characters With Notepad++

Tags:

notepad++

I have a data file with a fixed record length. There are no carriage returns or line feeds delimiting the records. How can I insert a carriage return linefeed pair at every X characters using Notepad++(where X is the record length)?

like image 592
DaveB Avatar asked Nov 22 '10 18:11

DaveB


People also ask

How do I do a carriage return in notepad?

Answer: Using /n will be interpreted as a Carriage Return/Line Feed (CR/LF) when importing records. Using /n/n will separate paragraphs with a blank line in between.

How do you create a carriage return in a text file?

CR and LF are control characters or bytecode that can be used to mark a line break in a text file. CR = Carriage Return ( \r , 0x0D in hexadecimal, 13 in decimal) — moves the cursor to the beginning of the line without advancing to the next line.

What is the carriage return character in notepad?

Carriage Return (CR): Also know as Cartridge return, It is a control character used to reset the position of the cursor to the beginning of the next line of a text file. Line Feed (LF): Also known as Newline Character or End Of Line Character (EOF) or line break.


1 Answers

I appreciate that it's not ideal, but I'm surprised no one offered this as a pure N++ solution

In a regular expression find/replace

Find:

(.{750}) 

Replace:

$1\r\n 

Roughly translated as...

Find:

750 instances of any character and remember the characters.

Replace:

The 750 characters we just remembered followed by a new line.

Although, to be honest, I'd stick to the powershell approach for anything more than a one-off run.

like image 66
BunjiquoBianco Avatar answered Sep 17 '22 16:09

BunjiquoBianco