Thank you in advance and sorry for the bad english!
I want
'Odd rows' 'CRLF' 'Even rows' CRLF' → 'Odd rows' ',' 'Even rows' 'CRLF'
Example Input:
0
SECTION
2
HEADER
Desired Output:
0,SECTION
2,HEADER
What I have tried:
Find: (.*)\n(.*)\n
Replace: $1,$2\n
I want ー Easy to see dxf
DXF file ok
ODD line abc...
(AWK)
you should match enter and space also, because there may be multiple spaces and new line available in string try this regex-
For you example data you could capture one or more digits in capturing group 1 followed by matching a newline.
In the replacement use group 1 followed by a comma.
Match
(\d+)(?:r?\n|\r)
Regex demo
Replace
$1,
.
matches a newline the same as it matches any other characer, so the first.*
is going to gobble up the whole string and leave nothing left.Instead, use a character group that excludes
\n
. Also, it's not clear whether your final line terminates with a\n
or not, so the Regex should handle for that:Find
Replace
Breakdown:
([^\n]*)
- 0 or more characters that are not\n
\n
([^\n]*)
(\n|$)
-\n
or end of string