Here the result of this command :

sudo dpkg -l | grep mariadb

It returns me this :

ic  mariadb-server-10.3                        1:10.3.23+maria~bionic                           amd64        MariaDB database server binaries

and I need to delete all mariadb files. What is the next command line that I should run?

Thank for your help.

$ for package in $( sudo dpkg -l | grep mariadb | awk ' $1 == "ic" { print $2 }' ); do apt remove "$package"; done
| improve this answer | |
  • I have an issue while trying to remove this mariadb-server-10.3 output : mariadb-server-10.3 E: Sub-process /usr/bin/dpkg returned an error code (1) – burslf Jul 24 at 21:10
  • What are you hoping $! will evaluate to in that awk script? It'll produce a syntax error. – Ed Morton Jul 26 at 18:40
  • It was a typographical error, it was supposed to be $1. It and the $1 which should have been $2 have been corrected. – DopeGhoti Jul 27 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.