String manipulation in shell

This is related to the mv TIL. You can use % to easily remove the file extension from a string with a filename:

$ file="example.txt"
$ echo "${file%.txt}"
example

% deletes the shortest match of the given pattern from the string. There is also #, ##, and %% that you can find more out about here .

This is useful when mass renaming files.

View on Github