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 -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -