I have a bunch of .txt files in a directory, and I want to be able to find these files and strip the extension from the file name.
I can find the files using:
$ find . -maxdepth 1 -type f -name "*.txt"
./0test.txt
./1test.txt
./2test.txt
./3test.txt
./4test.txt
./5test.txt
./6test.txt
./7test.txt
./8test.txt
./9test.txt
I then tried to use sed command to remove the ".txt" extension, like:
find . -maxdepth 1 -type f -name "*.txt" | sed "s/\.txt$//"
But I just get the file names listed without their extensions, and the actual file names remain unchanged.
So how do you actually change the file names themselves?