Hi guys, I have a file of multiple columns, this file is a txt, and I want to map it to search for a string. Consider a txt like this
the file is really long, like 500k of lines and i have to search (if possible non in a case sensitive way) the names that are equal to a value. Let’s assume that my variable temp is = to “john” it has to return 789
How can achieve it?
Have you tried anything? Does it work?
And how are the two columns separated? Is there a tab or does the
When column start at a fixed position?
Can the Name` column contain spaces?
no, cause i don’t know how to approach the problem
Did you try reading the file line by line, splitting the text, check if first element is what you are looking for and then you have it?
try bufio.NewScanner(file) and then .Scan() and scanner.Text()
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.