I have a text file that looks like this:
ABC gibberish
DEF gibberish
ABC text
DEF random
I only want to keep the lines that start with ABC. This is what I've tried:
val lines = sc.textFile("textfile.txt")
val reg = "^ABC".r
val abc_lines = lines.filter(x => reg.pattern.matcher(x).matches)
abc_lines.count()
The count returns 0 so nothing matches, where did I go wrong?