I have several files generated by a script but I neglected to have the script append a file extension.
Each filename contains the substring
k120 and no other file in the directory contains that substring.
I would like to append the
.dat extension to each of these files, but I'm very new to bash (and shell scripting in general) and I'm not sure where to start; how can I rename files based on a substring they contain? I figured I could use
| grep k120 but beyond that I'm not sure.
I could easily do this with a for loop and a regular expression but I'm guessing that's the wrong (long) way to go about it.