Pregunta

Through windows batch file, I am trying to -

a. open a folder > open latest '.hl7. file (by date) in the folder.

b. search a specific value in the file. e.g value of the key 'name'

c. echo the value.

I am new to scripting, Can anybody help me write a script for the same?

¿Fue útil?

Solución

I am not sure about the format of the HL7 files but this will get the most latest HL7 file into env variable MyFile and then print the lines in the file that have "name" in them.

@set MyFile=
@for /F %%I in ('dir /od /b *.hl7') do set MyFile=%%I

@if defined MyFile find "name" %MyFile%

If HL7 has many different formats you may be better off writing a program that uses an HL7 library to parse your file.

I hope this helps you get started.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top