Do you ever receive a file of HL7 with messages split into segments (one segment per line)?
Here’s a quick way to convert that to HL7 one message per line using Vim.
Place this line in your ~/.vimrc file.
” Convert HL7 files from one segment per line to one message per line
nnoremap :%s/n//g%s/rMSH/rMSH/g
” Split HL7 into one segment per line
nnoremap :%s//r/g
Then, open your HL7 file in Vim, and hit F3.
Example
MSH|^~&|INTELLIDOT||||20101011172748||RAS|1285683329013|P|2.3|
EVN|RAS|201010111726|
PID|||0070020689||TEST-PROD-INTELLIDOT^FIVE^|||||||||||||50280266|
PV1|||3 West^0350^01|
ORC|CM|242241837|61||||^BID|||admin^User^Admin|^^^^^^^N||||201010111726|
RXA|||201010112100||80100222^TACROLIMUS 0.5 MG CAP|1^250^MG|||Note|||||||||||CP|
RXR|PO|||MED|
MSH|^~&|INTELLIDOT||||20101011172748||RAS|1285683329013|P|2.3|
EVN|RAS|201010111726|
PID|||0070020689||TEST-PROD-INTELLIDOT^FIVE^|||||||||||||50280266|
PV1|||3 West^0350^01|
ORC|CM|242241837|61||||^BID|||admin^User^Admin|^^^^^^^N||||201010111726|
RXA|||201010112100||80100222^TACROLIMUS 0.5 MG CAP|1^250^MG|||Note|||||||||||CP|
RXR|PO|||MED|
MSH|^~&|INTELLIDOT||||20101011172748||RAS|1285683329013|P|2.3|
EVN|RAS|201010111726|
PID|||0070020689||TEST-PROD-INTELLIDOT^FIVE^|||||||||||||50280266|
PV1|||3 West^0350^01|
ORC|CM|242241837|61||||^BID|||admin^User^Admin|^^^^^^^N||||201010111726|
RXA|||201010112100||80100222^TACROLIMUS 0.5 MG CAP|1^250^MG|||Note|||||||||||CP|
RXR|PO|||MED|
See attached image for result.