Your need to selectively clean up your error database peaked my interest, so I thought I would see how I might get rid of selective messages from the error database by searching for a string in the user metadata.
I haven’t used the GUI much for data base stuff so you might check if there is some search capability built into the GUI.
I’m sure that are other ways but this is the first that came to mind for me.
I wanted to get a long list of everything in the error database to a file first so I did the following
hcidbdump -e -L >f1
Next I proceeded to get just the msgMid and msgUserData into a file using
egrep “msgMid|msgUserData” f1 >f2
at this point my test file looks like this
msgMid : [0.0.230768]
msgUserData : bogus
msgMid : [0.0.230802]
msgUserData :
msgMid : [0.0.232393]
msgUserData : bogus
msgMid : [0.0.232394]
msgUserData :
msgMid : [0.0.232395]
msgUserData :
Now I decided to join every other line in the file by using this command
paste -s -d” n” f2 >f3
so now I have this
msgMid : [0.0.230768] msgUserData : bogus
msgMid : [0.0.230802] msgUserData :
msgMid : [0.0.232393] msgUserData : bogus
msgMid : [0.0.232394] msgUserData :
msgMid : [0.0.232395] msgUserData :
now I search for the string bogus as follows
grep bogus f3 >f4
and end up with this
msgMid : [0.0.230768] msgUserData : bogus
msgMid : [0.0.232393] msgUserData : bogus
now I need to extract the msgMid(s) that I want removed from the error database and generate the hcidbdump commands to remove them so I did this next
cat f4 | awk ‘{print “hcidbdump -e -D -F -m “$3}’ >f5
which left me with this
hcidbdump -e -D -F -m [0.0.230768]
hcidbdump -e -D -F -m [0.0.232393]
which I ws able to run to selectively delete the unwated messages of interest from the error database.
Now that I have all the individual steps working I no longer desire the intermediate files to check my steps so I combined the working steps as follows (NOTE: the paste command wanted a file so I replaced that command with sed in this example rather than fight it):
hcidbdump -e -L
| egrep “msgMid|msgUserData”
| sed ‘$!N;s/n/ /’
| grep bogus
| awk ‘{print “hcidbdump -e -D -F -m “$3}’
Which results in the same output as before as follows which can be redirect to a file and run once comfortable it is doing what you want.
hcidbdump -e -D -F -m [0.0.230768]
hcidbdump -e -D -F -m [0.0.232393]
Be careful not to accidnetally put any blank space after any of the continuation characters at the end of each line or it will not work and will be hard to figure out what isn’t working.
Of course you will have to change the word bogus in my example to what works for your case.
I’ve got a feeling there is a more effecient way but I went with my first thought and I did learn how to combine every other line in a file which will be handy to have around for other situations.
Russ Ross
RussRoss318@gmail.com