#! /usr/local/bin/Rscript d <- getwd() files <- dir(d, patt = "[.]out$", full.names = TRUE) known <- scan("~/R/packages/known", '', quiet = TRUE) known <- paste0(d, "/", known, ".out") for (f in known) { if(!file.exists(f)) { ff <- sub("[.]out", "", basename(f)) message(sprintf("package %s has been removed", sQuote(ff))) next } lines <- readLines(f, warn = FALSE) st <- grepl("^Status.*ERROR", lines) if (!any(st)) { ff <- sub("[.]out", "", basename(f)) message(sprintf("package %s is no longer failing", sQuote(ff))) } } res <- character() files <- setdiff(files, known) for (f in files) { lines <- readLines(f, warn = FALSE) st <- grepl("^Status.*ERROR", lines) if (any(st)) { res <- c(res, paste0(basename(f), ":", lines[st])) } } writeLines(res, stdout())