There exists a directory, which includes several levels of sub-directories. Under these directories, there are a set of files whose names include a common word, e.g, .cc. How can I replace the .cc in the names of these files with .cpp?
Tell me more
×
Unix & Linux Stack Exchange is a question and answer site for
users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
|
|
|||||||||
|
|
When you say the files "names include a common word," I am assuming that you are referring to the fact that they share the
See this answer on SO for more detail |
||||
|
|
|
In zsh:
In bash ≥4:
In any shell:
Simpler, and portable to older systems, but slightly slower:
|
|||
|
|