Reputation: 684
I have file containing around ~1400 lines. In each line there are infomation + in next line is next information which I want move "to previous" line (where is text)
I tried " for" changing into "\r |" - only that was coming to my head in that time.
For example here it's "structure" of my file:
T="topic 1"
for [email protected]
T="topic 2"
for [email protected]
I wanted move that to clear into that
T="topic 1" | for [email protected]
T="topic 2" | for [email protected]
Upvotes: 7
Views: 6121
Reputation: 163427
Another option if you don't want keep for
could be to match:
\n[ \t]+for[ ]
That will match:
\n
Match a line break[ \t]+
Match 1+ times a space or char (Or just a single space if that is the case)for[ ]
Match for
followed by a space (the square brackets are for clarity onlyAnd replace with a space, a pipe followed by a space
|
Upvotes: 1
Reputation: 627022
You may use
Find what: \n( for)\b
Replace with: |$1
Details
\n
- a line break( for)
- Capturing group 1 ($1
): a space and for
\b
- word boundary.Test result:
Upvotes: 4