# Hack the result because I can't make it do what I want lines <- readLines("grid.html") unwanted <- grep('id="section"', lines) writeLines(lines[-unwanted], "grid.html")