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

.vnc folder becoming too large

0  Asked on December 13, 2020 by hardcorehenry


TTY size with dual monitors

0  Asked on December 12, 2020 by user66554


run a script in multiple folders in parallel

5  Asked on December 11, 2020 by user233520


Fill missing fields with values from the line below

4  Asked on December 10, 2020 by joni


How to batch convert bitmaps to SVGs?

5  Asked on December 10, 2020 by village


xRDP sound redirection ubuntu 20.04

0  Asked on December 9, 2020 by hlderlin


bash script not running at startup

3  Asked on December 9, 2020 by hexodus


find’s prune’s -path is not taking wildcards

2  Asked on December 8, 2020 by pompy


Taking an integer and creating a date format

1  Asked on December 7, 2020 by alar-yldz


GPU Offloading using wayland and x11

1  Asked on December 6, 2020 by hjahre


File Creating with read permission for root user alone

0  Asked on December 6, 2020 by mpsimham


Ask a Question

Get help from others!

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