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
Post a Comment