Artificial Intelligence (AI) & Machine Learning Course for ManagersEnroll Now
If you want to locate a word in files, you can use the grep command. Grep lists all the lines from files in which a particular word exists. Examples of grep
grep myword file1 file2
If you want to search in files recursively - inside every subdirectory of a directory, use the following command
grep -r myword directory
If you want to search case insensitive, use "-i" switch
grep -i myword file1 file2
grep is a very powerful tool. It can somewhat behave like where clause in sql queries.
Few Examples are:
Taking you to the next exercise in seconds...