How to remove all files containing a given string recursively using the Linux shell
This command will remove all text files containg abc123abc
recursively:
ag abc123abc --hidden -l | xargs rm -v
I have not tested with filenames containing spaces etc. The files will be deleted permanently, so try it out first using just
ag abc123abc --hidden -l
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow