My teacher only taught us grep at that point of time, therefore, only understand basic grep and did not know about awk. I asked around, most of my friends recommended me to use awk, but if i do that, i will have to redo my whole script as I'm using grep in most function to do searches. However, if i key in "example 1" and "basic mathematics", it will echo out the output. So if i key in "example" and "mathematics", it will return false. Example 3:How to create a good example ?.Is there anyway to make the search more flexible, or to let it search specifically, like there are many examples in the info.txt. I am currently using if statements, if both $example and $subject have information in it, it will do specific search, like literally string matching string, else it will return false. I need this function so that the user can do a general search on what are the list of available reading materials there are in the info.txt. The output will be all the lines of string that has, let's say i key in "example", it will display all the lines of string that has the string "example". Grep -i ^$example info.txt | grep -i ^*:$subject I know grep can be use to do partial search, for example if i use echo "Enter example"
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |