Clovertech
› Clovertech Forums › Read Only Archives › Cloverleaf › General › Need Grep help
I need to grep for the following:
PM||12345678912345||ADT^Z46
where 12345678912345 is the date and time the message was sent. Can anybody help me out?
where 12345678912345 is the date and time the message was sent.
-- Max Drown (Infor)
that would appear to match on all lines for some reason.
i used the command
egrep -E ‘PM||[0-9]+||ADT^Z46’
also tried
egrep ‘PM||[0-9]+||ADT^Z46’
both times all rows are returned.
but maybe the message files are seen as all one line
grep ‘PM||12345678912345||ADT^Z46’
The pipes are special characters in egrep, but you stick with grep, you only have to worry about the caret.
I’m assuming that “12345678912345” needs to be a pattern? Or is that the actual string you want to search for?
Can you paste a few sample lines here?
They are message files from smat. but they look like
MSH|^~&|NE|NE|PM|20091109235806||ADT^Z46……..more message out this way.
I think i have bigger problems than this because those files aren’t line delineated. They are all one line.
any ideas on how to pull just the messages that have the search string in them and not the entire file?
Take a look at this link: https://usspvlclovertch2.infor.com/viewtopic.php?t=3097&highlight=useful+hl7+scripts
That’s what it was. I used msgExtract.pl to convert the file then the egrep command worked like a charm.
thanks