concatenate to previous line

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
C0ppert0p
Posts: 12
Joined: Wed Aug 17, 2011 4:09 pm

concatenate to previous line

Post by C0ppert0p »

I have a need to concatenate lines matching a pattern to be concatenated with the preceding line.
Example:

INPUT

Description: Process STORE.EXE (PID=3364).
(Server name | Roles | Enabled | Reachability.........
In-site:
servername1.local CDG 1 7 6 1 0 1 1 1 2
servername2.local CDG 1 7 7 1 0 1 1 7 1


OUTPUT

Description: Process STORE.EXE (PID=3364). (Server name | Roles | Enabled | Reachability.........
In-site:servername1.local CDG 1 7 6 1 0 1 1 1 2 servername2.local CDG 1 7 7 1 0 1 1 7 1


The issue I have is that the PID=3364 varies; the CDG value varies and not all lines starting with, "Description", end with a PID.
However any line starting with Servername 2.local CDG should be concatenated with the previous line.
And, and line beginning with, "(Server name" should be concatenated with the previous line.

I have thousands of these records so doing it manually is out of the question
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

Replace (Regular Expressions checked, Posix Syntax selected):

\n\(Server
by
\(Server


and in a second step:
\nservername
by
servername

(If you want a space before the (Servername or servername, add it to the beginning of the replace by value)
C0ppert0p
Posts: 12
Joined: Wed Aug 17, 2011 4:09 pm

Post by C0ppert0p »

That was the solution I was hoping for.
Cheers!
Post Reply