I will read a file and search for a string in it. and also which line number to find string
here is code
fs.readFile('input.txt', "utf-8", function(err, data) {
if (err) throw err;
console.log(data)
}
How to find string and line number
input.txt
- my
- name
- is
- Arjun
output:
line number, string
4, Arjun