Homepage › Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › hcidbdump delete multiple records(not a range)
- This topic has 14 replies, 4 voices, and was last updated 16 years, 7 months ago by Russ Ross.
-
CreatorTopic
-
February 29, 2008 at 4:49 pm #49867Cesario PerezParticipant
I am trying to use the hcidbdump -r -m -D command where I need to delete by multiple message ids and not a sequential range, in one statement. And/or delete records for a destination thread that may contain a string value of ex: “BADTABLE” in the message context. Any ideas? -
CreatorTopic
-
AuthorReplies
-
-
February 29, 2008 at 8:45 pm #63936Todd LundstedtParticipant
If you know the MIDs, you can loop through them.. AIX ksh…
for i in list of MIDs; do hcidbdump -r -D -m $i ; done
-
February 29, 2008 at 9:05 pm #63937Cesario PerezParticipant
Todd, I tried that and that is better than what I was doing. How about a shot at the other situation where I want to delete all records which contain a selected string value in the hl7 message? Come on dude.. you are on a roll. -
February 29, 2008 at 9:55 pm #63938Cesario PerezParticipant
Todd I forgot to say Thanks Alot!! -
March 2, 2008 at 4:12 pm #63939Russ RossParticipant
I’m dealing with an on-call issue and waiting so I did a test to pass the time and give you some direction hopefully and learn something usefull myself. In my test I pulled all the message IDs for all the A04 messages in the recovery data base.
Just switch A04 with what you want to search for.
I also created temp# files with each step so you can get a feel for what is being done along the way and can check the files to gain confidence.
Here is my quicky KSH script I called rkr_search_db.ksh
Code:#!/usr/bin/ksh
myString=”A04″
rm -f temp*
hcidbdump -r -L | egrep “msgMid|$myString” >temp1
cat temp1
| perl -pi -e ‘s/^.*msgMid/nmsgMid/g’
| perl -pi -e ‘s/]n/] /g’
>temp2cat temp2 | egrep “msgMid.*message” >temp3
cat temp3 | awk ‘{print $3}’ >temp4
cat temp4
For some reason when I copied/pasted this into a script and ran it I found out clovertech is still having issues.
I discovered clovertech web page is adding an extra artifical blank space to the end of every line.Go ahead and highlight something to copy and you will see every line has an extra space artifically added to the end of each line.
hcihd helped me figure this out when I copied/pasted the script straight from clovertech and it would not work until I got rid of the extra space at the end of each line as follows
perl -pi -e ‘s/ n/n/g’ my_script.kshUnfortunately, that is a problem with copying code from clovertech so be sure to get rid of the extra space off the end of each line of code.
Russ Ross
RussRoss318@gmail.com -
March 3, 2008 at 3:27 pm #63940Cesario PerezParticipant
Mr. Ross, This code is heading right on target of what I am looking for. I have ran it by editing by message trigger P03 and by a patient name which I know exists in some of the recovery records. This code definitely locates the records I need. Ultimately this code will be replaced by including the -D parameter for the deletion of records. I am receiving the error below… but as expected I know i have to troubleshoot this. Thanks alot.
cat: 0652-050 Cannot open .
/hci/data/scripts/hcidbdumpstring.ksh[10]: 0403-057 Syntax error at line 10 : `|’ is not expected.
-
March 3, 2008 at 5:20 pm #63941Cesario PerezParticipant
Russ, I guess I did not really identify a space insert at the end of each line when I entered hcihd
. So out of curiousity I entered .. perl -pi -e ‘s/ n/n/g’ my_script.ksh and reran the script and I got much better results. Sorry about claiming further work on the code… my bad. -
March 3, 2008 at 7:54 pm #63942Todd LundstedtParticipant
Cesario, I would not recommend just including the -D, as that will delete all recovery messages. You will need to add an addtional hcidbdump command, similar to the for-loop I suggested, using that tempfile as input to the list of MIDs.
Also, use caution with your search string. If you are looking for patients by name (SMITH^JOHN), you will get records with doctors, or guarantors, or whatever named John Smith, too. I highly recommend you create a TCL or some other script that identifies the msgID of a message where the contents of a specific field match the string you are searching for.
-
March 3, 2008 at 8:47 pm #63943Cesario PerezParticipant
Todd, I agree that I would probably use the temp3 and temp4 files for validation and conditional deletion of records. I came up with a need for this when testing systems seems to mess up with alot of undesired or “messed” up records pending to be sent to a system If I ever used something like this production I would 100% sure of having a very unique id method. If anything in prod that I have ever seen a need for like this would be by ex: patient id. or message type or a definte error string like “BADTABLEREAD”. I sure appreciate everyones ideas and concerns.
-
March 3, 2008 at 9:33 pm #63944Rob AbbottKeymasterRuss Ross wrote:
For some reason when I copied/pasted this into a script and ran it I found out clovertech is still having issues.I discovered clovertech web page is adding an extra artifical blank space to the end of every line.*snip*
Unfortunately, that is a problem with copying code from clovertech so be sure to get rid of the extra space off the end of each line of code.
Russ, I’m not sure what you’re doing, but I’m unable to reproduce this.
I’ve pasted code here that I copied from a PuTTY session on a unix machine:
Code:riscy:[505]~> cat test.txt
line one
line two
line three
riscy:[506]~>I don’t see any extra lines as I do in the code you provided. Perhaps something is going on with your terminal emulator or your copy/paste method?
If this is a huge problem for you, you can always attach your code as a file.
Rob Abbott
Cloverleaf Emeritus -
March 4, 2008 at 1:12 pm #63945Russ RossParticipant
Rob: Thanks for investigating because this is a problem at least for me and Cesario.
This may have been happening all along and it did not show up for me until I used the line continuation character
Russ Ross
RussRoss318@gmail.com -
March 4, 2008 at 2:10 pm #63946Rob AbbottKeymaster
I see what you mean Russ. My apologies, I read you incorrectly; I was seeing extra linebreaks not an extra space at end of line. Not sure what we can do about that but I’ll investigate. Rob Abbott
Cloverleaf Emeritus -
March 4, 2008 at 2:59 pm #63947Rob AbbottKeymaster
I think I’ve squashed this bug, please let me know if things look OK. Rob Abbott
Cloverleaf Emeritus -
March 4, 2008 at 3:23 pm #63948Russ RossParticipant
Test posting my script to see if copy/paste no longer adds extra space to each line of code Code:#!/usr/bin/ksh
myString=”A04″
rm -f temp*
hcidbdump -r -L | egrep “msgMid|$myString” >temp1
cat temp1
| perl -pi -e ‘s/^.*msgMid/nmsgMid/g’
| perl -pi -e ‘s/]n/] /g’
>temp2cat temp2 | egrep “msgMid.*message” >temp3
cat temp3 | awk ‘{print $3}’ >temp4
cat temp4
Russ Ross
RussRoss318@gmail.com -
March 4, 2008 at 3:31 pm #63949Russ RossParticipant
Rob: I was now able to copy/paste from clovertech without having an extra space artifically added to the end of each line.
Now the script ran as is without having to massage it after doing a copy/paste from clovertech.
I was even able to copy/paste the original post successfully, which indicates your fix worked for previously existing post, too.
Thanks for fixing this behavior.
Russ Ross
RussRoss318@gmail.com
-
-
AuthorReplies
- The forum ‘Cloverleaf’ is closed to new topics and replies.