Find and hide file extension
- by Daveo
I am trying to find all files that have the same filename (excluding the file extension) that occur 3 times. I also need the full path to the file.
What I have currently is
#get file without extension
alias lse="ls -1R | sed -e 's/\.[a-zA-Z]*$//'"
#print out the current dir and get files occuring 3 times
lse | sed "s;^;`pwd`/;" | sort | uniq -c | grep " 3 "
This runs howver pwd prints the folder I ran the command from not the path to the file.
So I tried find
find . -type f | sed "s#^.#$(pwd)#" | sort | uniq -c
This runs but includes the file extension. When I try to add sed -e 's/\.[a-zA-Z]*$//'"
I get errors as I am not sure how to combine the two sed commands and I cannot seem to pipe a second time to sed?
so what I am trying to do is
find . -type f | sed "s#^.#$(pwd)#" | sed -e 's/\.[a-zA-Z]*$//'"| sort | uniq -c | grep " 3 "
but this does not run.