Skip to Content

Replace Newline Characters With Commas Using tr, Not sed

I recently had a 5.0.9 Zimbra mailbox with inconsistencies between metadata (MySQL DB) and blob store (/opt/zimbra/store/...) in which the store was missing blob data referenced in the database.

Once I parsed the zmblobchk report data to retrieve information for the mailbox I wanted to fix, I wanted an efficient way to remove the blob item references from the database.

All commands run as zimbra user.

A snip from zmblobchk's mb8blobcheck.rpt file:

* MailboxGroup=8, mailbox=8, item=397: file not found: 397-2020.msg (delete associated metadata)
* MailboxGroup=8, mailbox=8, item=398: file not found: 398-2021.msg (delete associated metadata)

Grab the item IDs using awk piped to sed:

awk -F"item=" '{ print $2 }' mb8blobcheck.out | sed -e 's/: file not.*//g' > mb8blobitems.out

Replace newline characters with commas using a tr and sed combo so the list can be used in a MySQL delete query:

cat mb8blobitems.out | tr '\n' ',' | sed -e 's/,$//g' > mb8blobitems.csv


cat mb8blobitems.csv
397,398

Use the .csv in a MySQL delete query to remove the bad entries:

mysql mboxgroup8 -e "DELETE FROM mail_item WHERE mailbox_id=8 AND id IN(`cat mb8blobitems.csv`)"

Thanks to http://funarg.nfshost.com/r2/notes/sed-return-comma.html for this tip.

online cialis

Cheap Phentermine

Xanax

generic cialis

Xanax

Valium

Buy Xanax

Buy Phentermine

viagra alternative

Buy Xanax

Cheap Phentermine

viagra online

Xanax

buy viagra

Buy Ambien

cialis online

buy cialis

cialis online

Services

truly, if the accuracy were recognized, this was the very first compound used as an buy nolvadex without prescription accessory medication by steroid-using athletes. Dan Duchaine had first speculated that it could perhaps be applied by bodybuilders to halt the development of gynocomastia chest tissue in males, because it was used to finish breast tumors in women.

Cigarettes

Tramadol

Xanax

erectile dysfunction

Services

Augmentin is an antibiotic medicament that is available by prescription. It can be used to deal a number of different augmentin how long to work bacterially infections. The dose, which comes in pills, chewable tabs, and a liquid form, is general accepted every 8 or 12 hours - depending on the particular production and dosage.

Viagra

generic viagra

cialis

Cheap viagra

buy cialis

cialis

viagra

Cheap Tramadol

Services

Acomplia is a popular weight loss medication that is usually buy acomplia came with by practice and diet in place to treat overweight or corpulent patients who are bearing from highly blood points of fat or patients who are enduring from diabetes type 2.

Services

Acomplia is a popular slant departure medicament that is normally buy acomplia without prescription accompanied by exert and diet in club to cover fleshy or corpulent patients who are suffering from extremely high blood levels of fat or patients who are tolerating from diabetes type 2.

cialis

Services

Tenormin can do slope results that may mar your intending or responses. Be heedful if you drive or do anything that takes buy tenormin online you to be awaken and alert. Void drinking inebriant, which fired increase drowsiness and giddiness while you are assuming Tenormin.

Services

Don't use singular to treat an bronhial asthma assault that has already set out. It will not work singulair tablets quick enough to reverse your symptoms. Apply only a fast-acting inhalation medication to cover an asthma attack..

Ativan

bu sitelerde güzel sözler ve

bu sitelerde güzel sözler ve aşk sözleri bulabilir e-okul sistemi hakkında yardım alabilirsiniz.

güzel sözler,aşk sözleri,kısa aşk sözleri,tv izle,aşk sözleri kısa,dizi izle,fragman,muzik dinle,canlı tv izle,e-okul sistemi,güzel sözler

Viagra

cheap cialis

Viagra

Xanax

buy cialis

Cialis

Buy Phentermine

cialis

Xanax

Phentermine

Services

No bad post, write more