Im trying to use find and cut, but instead of cutting the characters I want to save, I want to cut those characters leaving the rest of the results of my find command.
For example:
I have a file with the same name in multiple directories. I want to find just the directories that file is in but I do not want to print the file name.
/path/to/file.txt
/path/to/another/file.txt
/path/to/yet/another/file.txt
So my "command" would be:
[QUOTE]find / -name file.txt print just the directories[/QUOTE
Ive tried the type d flag but it doesnt seem to work if you are using file names)
So my results would be
/path/to/
/path/to/another/
/path/to/yet/another/
Ive tried various pipes to cut to remove the last 8 characters as that's my only constant. But instead of cutting file.txt off and leaving the directories it only cuts file.txt so my result is:
file.txt
Or is there a way to use find to find a file name but just print the directories they are in?
commands Ive tried:
Quote:
find / -name file | cut -c -8
|
This cuts everything after the first 9 characters of my find result. I want to cut the last 8 characters of the result leaving the rest of the line.
Confused yet?
Thanks!