

path <- "/esarchive/exp/hadgem3/cmip6-historical_i0p1/original_files/cmorfiles/"
path <- "/esarchive/exp/CMIP6/dcppA-hindcast/hadgem3-gc31-mm/cmip6-historical_i0p1/CMIP/MOHC/HadGEM3-GC31-MM/historical/r1i1p1f1/Amon/tas/gr/v20200101"

files <- list.files(path)
info <- strsplit(files, "_")
info <- data.frame(matrix(unlist(info), nrow = length(info), byrow = TRUE))
info[,7] <- unlist(strsplit(as.vector(info[,7]), ".", fixed = TRUE))[seq(1, dim(info)[1]*2, 2)]

apply(info, 2, unique)

apply(subset(info, X1 = 'pr'), 2, unique)


