Stuck on solution

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
Garren

Stuck on solution

Post by Garren »

I have a single file with a bunch of addresses and other info in them. This file is used in another process but I need the name and date to be on the same line.

Here is the first example:

JESSICA SMITH P 05-23-02
123 Main Street
VICTORIA BC 1550.00
V8V-1B9 CANADA RI 00001

notice the name and address are on the same line. Here is the second example:

P 05-23-02
WILLIAM JONES
191 MAIN ST 2222.00
BRISTOL NH 03222

When there are only 3 address lines the name and date aren't on the same line. I need a way for when there are only 3 address lines to delete the date line and insert it on name line or move the address lines up to the date line.

I noticed the BB reformated my text so here is an image of how the text with spaces is in the file:
Image

Any ideas?
Thanks,
Garren
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Post by DataMystic Support »

Hi Garren,

Use a pattern match to find lines with say, 30 or more spaces followed by the P, then the date eg

[ ]{30,}P([^\r\n]*)\r\n([^\r\n]*?)

Replace with

$2 $1
Post Reply