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.
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.
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
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:
Or is there a way to use find to find a file name but just print the directories they are in?
commands Ive tried:
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.