I think it is powerful enough to upgrade your coding skill.
I used this one for searching specific period of each data of CMIP5 datasets.
Result after typing “ls”, ther are serveral data, and I want to know only start and end year.
$ ls *.nc > list # save the information to the “list”
$ syear = cut -d’_’ -f6 list | cut -c1-6 | head -1 # take “200601”
$ eyear = cut -d’_’ -f6 list | cut -c8-13 | tail -1 # take “230012”
*cut -d’_’ -f6 list : cut and take only the 6th word after the symbol of ‘_‘ in the “list”
*cut -c1-6 : then, take only 6 letters from the word.
*head -1 : finally, do this at the just one line from the first/last (head/tail).
summary: 200601-205512.nc -> 200601
So, Simple 🙂