How to make all data in one line
-
Hello .
I have txt file with example 1000 line I would like to have all of them in on line.
It` s possible to use Backspace or delete of end of the line but cost lot of time .
any ideas? -
Hello, @djmcg,
Very easy, indeed !
-
Open your file in Notepad++
-
Open the Replace dialog (
Ctrl + H
) -
Check the Wrap around option
-
Choose the Regular expression search mode
-
Fill in the regex
(\h*\R)+
in the Find what: zone -
Fill in the regex
\x20
in the Replace with: zone -
Click on the Replace All button
Of course, you could have used the two N++ built-in commands Edit > Blank operations > EOL to Space or Edit > Blank operations > Remove Unnecessary Blank and EOL, but :
-
The later command does not merge consecutive Line Break, before changing it by a single Space character
-
The former command acts as the later command and, in addition, does not trim any trailing blank character ( Space or Tab ), before replacing it by a single Space character
On the contrary, my regex will replace, systematically, any gap between two non-empty lines, with a single Space character :-)) Saying “non-empty lines”, I mean lines containing, at least, one non-blank character !
Now, if your text contains some words, separated with more than 1 space or with Tabulation characters and than you would like to normalize all these blank characters, between words, to a single Space character, use the following regex S/R :
SEARCH
\h{2,}
REPLACE
\x20
Notes :
-
The quantifiers :
-
*
, or{0,}
, means0
ormore
times, the preceding character or group -
+
, or{1,}
, means1
ormore
times, the preceding character or group -
{2,}
means2
ormore
times, the preceding character or group
-
-
\x20
represents any single Space character, of Unicode value\x{0020}
-
\h
represents any single Horizontal Blank character :-
The Space character, (
SP
), of Unicode value\x{0020}
-
The Horizontal Tabulation character, (
HT
), of Unicode value\x{0009}
-
The No-Break Space character(
NBSP
) , of Unicode value\x{00A0}
-
-
\R
represents any single New Line sequence :-
The usual Line Break character(s) :
-
\r\n
, of Unicode value\x{000D}\x{000A}
, in a Windows file -
\n
, of Unicode value\x{000A}
, in a Unix file -
\r
, of Unicode value\x{000D}
, in a Macintosh file
-
-
The Vertical Tabulation character, of Unicode value
\x{000B}
-
The Form Feed character, of Unicode value
\x{000C}
-
The Next Line character (
NEL
), of Unicode value\x{0085}
-
The Line Separator character, (
LS
), of Unicode value\x{2028}
, in a Unicode encoded file -
The Paragraph Separator character, (
PS
), of Unicode value\x{2029}
, in a Unicode encoded file
-
So, to be short :
-
The regex
\h
is equivalent to the regex[\t\x20\xA0]
-
The regex
\R
is equivalent to the regex\r\n|[\n\x0b\f\r\x85\x{2028}\x{2029}]
Best Regards,
guy038
-
-
Hello guy038
The first option`s works perfectly.
Thank You.