Replace every n-line with tabs in the file
Here's how to do it:
Find what: (.+)\R(.+)\R(.+)\R(.+\R)?
Replace with:$1\t$2\t$3\t$4
Check Regular Expression
Do NOT check dot matches newline
and click Replace All
.
Explanation:
(.+)\R : Capture in group 1 everything until a line break (excluded)
(.+)\R : Capture in group 2 everything until a line break (excluded)
(.+)\R : Capture in group 3 everything until a line break (excluded)
(.+\R)? : Capture in group 4 everything until a line break (included), optional
\R
denotes any type of string (i.e. \R
either \n
or \r\n
)
source to share
[\n\r](?!#)
Will do and replace with \t
It will replace crlf if no # by tab follows after using windowed encoding.
(?!#)
- negative result, which excludes any \ n or \ r followed by # (on the next line)
Beware of leaving a space in front of the tabs, if you really only want the tab between each field, you may need to change the encoding to only have \ n or \ r (linux or mac).
source to share