I am facing an issue of searching through lines of text in a text file.
Currently, I am using this command
check=`awk -F : -v "title=$title" 'tolower($1) ~ tolower(title)' test.txt`
It works fine when the strings are pure alphabetic characters. Assuming the text file contains 3 lines of string which are
C++ Programming in 21 Days
C## Programming in 21 Days
C Programming in 21 Days
When I do a partial search for just a letter C
, 3 of the results will be displayed, which is what I want, however, if I keyed in C++ P
, my program will return text not found. And if i key in C++
, all 3 results will be displayed as well.
But the funny thing is, if I search for C## P
, my program will return C## Programming in 21 Days
found.
I can't seem to find out what is causing this error, please help.