Getting a list of directories with certain files inside...
Hello, I'm new to linux, and I am trying to get a list of directories that contain files with a certain extention. So far I have:
find | grep -i *bit$ but this gives me all the files. What is the best way to just get a list of directories that contains .bit files? Thanks! |
try
find /path -name "*.bit" |
Quote:
|
here works...
try without " find /path -name *.bit |
Ok, so this:
find -name \*.bit -printf %h\\n gives me all the directories, but it repeats directory names. Now I just need to trim it down to no repeat directories. |
Quote:
|
If you want to remove duplicates, go with:
command | sort | uniq The other command given by somebody else works though, replace path by the real path and don't forget about the " otherwise the shell will happily replace it before running the find which would result in no matches |
Quote:
find -name \*.bit -printf %h\\n | uniq works. I will try the other command as well, with the real path. Thanks! |
All times are GMT -5. The time now is 10:52 AM. |