I have a list of file names like this:
REG_2016120200hourly_d01_20161202_00_00_00.nc
Of this name I would like to extract and put in a variable:
timestep="${filename:34:2}"
2 is length.
2
From man bash:
man bash
${parameter:offset:length}: Substring Expansion. Expands to up to length characters of the value of parameter starting at the character specified by offset. [...]
${parameter:offset:length}