› Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › hcidbdump delete multiple records(not a range)
AIX ksh…
for i in list of MIDs; do hcidbdump -r -D -m $i ; done
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
#!/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’
>temp2
cat 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.ksh
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 Ross
RussRoss318@gmail.com
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.
I guess I did not really identify a space insert at the end of each line when I entered hcihd
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.
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.
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:
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
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
Rob Abbott
Cloverleaf Emeritus
Rob Abbott
Cloverleaf Emeritus
#!/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’
>temp2
cat temp2 | egrep “msgMid.*message” >temp3
cat temp3 | awk ‘{print $3}’ >temp4
cat temp4
Russ Ross
RussRoss318@gmail.com
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