8
votes
4answers
4k views

Remove files older than 5 days in UNIX (date in file name, not timestamp)

I want to delete log files which are older than 5 days from a directory. But deletion should not be based on the timestamp of file. It should be based on the name of file. For Example todays date is ...
2
votes
3answers
1k views

Delete files if contents do not match pattern

There are hundreds of .html files in a directory. I need to delete files that don't contain word bluecar in their contents. I thought sed with rm would do that, but I don't know how to combine them.