NOAA-EDAB / ecodata

A data package for reporting on Northeast Continental Shelf ecosystem status and trends.
https://noaa-edab.github.io/ecodata/
Other
31 stars 12 forks source link

tech-memo to tech-doc #19

Closed slarge closed 5 years ago

slarge commented 5 years ago

Need to change "tech-memo" to "tech-doc"

Originally posted by @slarge in https://github.com/NOAA-EDAB/tech-doc/issues/37#issuecomment-474044622

slarge commented 5 years ago

"Sanitizer" code:

all_files <- list.files(pattern = "\\.[R-r]$", include.dirs = TRUE, recursive = TRUE)

for(i in 1:length(all_files)){
  dat <- readLines(all_files[i], warn = FALSE)

  if(length(grep("tech-memo", dat)) >= 1) {
    dat <- gsub("tech-memo", "tech-doc", dat)
    cat(paste0(all_files[i], "\n"))
    file_connection <- file(all_files[i])
    writeLines(dat, file_connection)
    close(file_connection)
  } else if(length(grep("tech-memo", dat)) == 0) {
    dat <- NULL
  }
}