Add phrase to blank line above certain lines...

General questions about using TextPad

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

Post Reply
agent86
Posts: 18
Joined: Wed Apr 26, 2006 2:59 am
Location: SF Bay Area

Add phrase to blank line above certain lines...

Post by agent86 »

I want to do the following... insert '***END***' on the blank line above any line that starts with 'MSH|^~\'

before:

MSH|^~\&|CELLNETIX|PATHOLOGY|||
PV1|1||||||KOAD01^Koala^Diana^K
ORC|NW||P09-035258||||||2009050
OBR|1||P09-035258|GYN^PAP Smear

MSH|^~\&|CELLNETIX|PATHOLOGY|||
PV1|1||||||DANA01^Daniel^Anna^G
ORC|NW||P09-035259||||||2009050
OBR|1||P09-035259|GYN^PAP Smear

MSH|^~\&|CELLNETIX|PATHOLOGY|||
PV1|1||||||KOAD01^Koala^Diana^K
ORC|NW||P09-035258||||||2009050
OBR|1||P09-035258|GYN^PAP Smear

MSH|^~\&|CELLNETIX|PATHOLOGY|||
PV1|1||||||DANA01^Daniel^Anna^G
ORC|NW||P09-035259||||||2009050
OBR|1||P09-035259|GYN^PAP Smear

after:

***END***
MSH|^~\&|CELLNETIX|PATHOLOGY|||
PV1|1||||||KOAD01^Koala^Diana^K
ORC|NW||P09-035258||||||2009050
OBR|1||P09-035258|GYN^PAP Smear
***END***
MSH|^~\&|CELLNETIX|PATHOLOGY|||
PV1|1||||||DANA01^Daniel^Anna^G
ORC|NW||P09-035259||||||2009050
OBR|1||P09-035259|GYN^PAP Smear
***END***
MSH|^~\&|CELLNETIX|PATHOLOGY|||
PV1|1||||||KOAD01^Koala^Diana^K
ORC|NW||P09-035258||||||2009050
OBR|1||P09-035258|GYN^PAP Smear
***END***
MSH|^~\&|CELLNETIX|PATHOLOGY|||
PV1|1||||||DANA01^Daniel^Anna^G
ORC|NW||P09-035259||||||2009050
OBR|1||P09-035259|GYN^PAP Smear
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Thanks for the great "before" and "after" examples, makes it much easier to understand your problem.

Here is an untested solution to try:

Search for: \n\n(MSH\|\^~\\)
Replace with: \n***END***\n\1

Use the following settings:
-----------------------------------------
[X] Regular expression
Replace All
-----------------------------------------
Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
-----------------------------------------
Hope this was helpful.............good luck,
Bob
agent86
Posts: 18
Joined: Wed Apr 26, 2006 2:59 am
Location: SF Bay Area

Thank you..

Post by agent86 »

I love this forum!
Post Reply