java search with help of grep linux -


i have following java code search on word in file, if word found stored line contains word in lista.

list<string> lista = new arraylist<>(); bufferedreader bf = null; string findword = "city"; string line=""; bf = new bufferedreader (new filereader(file)); while((line = bf.readline()) != null) {   if(line.contains(findword))   {     lista.add(line);    } } bf.close(); 

qustion: how use grep in code?

grep findword filename 

and store result in lista

the file search in big more ~2gb.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

javascript - How to bind ViewModel Store to View? -

javascript - Solution fails to pass one test with large inputs? -