Load the textFile as an RDD. Something like this: > > > val file = sc.textFile("/path/to/file")
After this you can manipulate this RDD to filter texts the way you want them : > > val a1 = file.filter( line => line.contains("[ERROR]") ) > > val a2 = file.filter( line => line.contains("[WARN]") ) > > val a3 = file.filter( line => line.contains("[INFO]") ) You can view the lines using the println method like this: > > a1.foreach(println) You can also count the number of such lines using the count function like this: > > val b1 = file.filter( line => line.contains("[ERROR]") ).count() Regards, > *Ritesh Kumar Singh,**https://riteshtoday.wordpress.com/ > <https://riteshtoday.wordpress.com/>*