How to delete files using grep?

Unix & Linux Asked on January 5, 2022

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.

One Answer

$ for package in $( sudo dpkg -l | grep mariadb | awk ' $1 == "ic" { print $2 }' ); do apt remove "$package"; done

Answered by DopeGhoti on January 5, 2022

Add your own answers!

Related Questions

How to validate a line if followed by a specifc line?

2  Asked on December 29, 2020 by user441539


LightDM: how to distinguish users with the same name?

2  Asked on December 29, 2020 by maddin25


Making bit identical ext2 filesystems

4  Asked on December 28, 2020 by jhufford


Which installed software packages use the most disk space on Debian?

9  Asked on December 28, 2020 by mirzhan-irkegulov


How to force ddclient to use only HTTPS?

0  Asked on December 28, 2020 by mountainx


How to execute a script after every systemd automount?

1  Asked on December 27, 2020 by john-wh-smith


How to detect and clean up junk journal files?

1  Asked on December 27, 2020 by reinierpost


ARM LXC Container template

2  Asked on December 27, 2020 by bulkmoustache


Updating kernel: vmlinuz in /boot not being created by DNF

4  Asked on December 26, 2020 by big-millz


Samba shared folder with setgid problem

1  Asked on December 24, 2020 by alex-forencich


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP