I want to search a series of files based on the files name.
Here is my directory :
For example I had the file on above.
I only want to search out the file which is without _bak.
I want to search a series of files based on the files name.
Here is my directory :
For example I had the file on above.
I only want to search out the file which is without _bak.
If you're wanting to limit your search to the current directory, use:
find . -maxdepth 1 -mindepth 1 ! -name '*_bak'
If you want to recursively find in all directories remove the -maxdepth 1
.
Edit in response to OP's comment
To get files that begin with ei
and do not end with _bak
use:
find . -type f -name 'ei*' -a ! -name '*_bak'
Please try this:
find . -type f ! -iname "*_bak"
The above command will find all files that have not end with _bak
.
Use the Grep Invert Match option.
For example, if you want all the file without the word _bak, use :
grep -v *_bak /path/to/file