Answer the question
In order to leave comments, you need to log in
Find filenames based on month. How?
There are the following files:
01 /01/
2018.7z 11/30/2018.7z 02/02/
2018.7z 04/30/
2018.7z
I want to find all files, excluding those that belong to the last days of the month. These include files 2 and 4 in the list (there are 30 days a year in both months.)
This is how it searches separately for everything except November:
find /mnt/zd-backup ! -name "30.11*"
01.01.2018.7z
02.02.2018.7z
04.30.2018.7z
and so, everything except April:
find /mnt/zd-backup ! -name "30.04*"
01 /01/2018.7z 11/
30 /2018.7z 02/02/
2018.7z
But how do I combine such a search into one line? After all, there are 4 months with 30 days. in a year.
I tried like this, but it didn't work:
find /mnt/zd-backup ! -name "30.(04|11)*"
Answer the question
In order to leave comments, you need to log in
find /mnt/zd-backup -regextype posix-extended -regex '0\d\.\d+\.\d+\.7z'
1 option | grep -v "шаблон " | grep -v "шаблон2"
2. option
find /mnt/zd-backup -type f -regex "30\.\(04\|11\)"
- who will screen special characters for you?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question