I was reading about rename and came across this example to change the file extension from htm to html:
rename -v 's/\.htm$/\.html/' *.htm
and it said: The $
means the end of the string. \.htm$
means that it will match .htm
but not .html
.
I was a bit confused by the use of $
here. Since we already specified *.htm
at the end of command line, rename
would only select out the htm files (instead of html). So why was it necessary to use the $
still? In another words, what's wrong with no using $
?