x <- "A\tB\t\n\n\n\nD\tF"gsub("\t*\n[\t\n]*", "\n", x)
Standard input is empty
[1] "A\tB\nD\tF"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!