![]() ![]() If what we want is to search for two different words we will use the command gooseberry: egrep -w bosques|plantas /ruta/del/archivo Know how many times a word appears in a file The above command would search for "forests", ignoring rangers, in the file "vacation.txt" in the indicated path. If we want find an exact word we will use the -w option: grep -w bosques /home/pablinux/Documentos/vacaciones.txt For example, this can happen to us in compound words and by searching for "forests" we can find "rangers". Sometimes there are files that contain what we want to search for something else. ![]() We can join the options together and write "-hR" without the quotes. If we don't want to see the file names in the data output we'll use the -h option (from "hide" hide): grep -h -R Pablinux /home/ We will see the results for "Pablinux" on a separate line preceded by the name of the file in which it was found. For example, read all the files in each directory that contain the word "Pablinux". Grep it also allows us perform searches subject to recurring rules or guidelines. This is the most normal thing in the world because a user does not have permission to access the content of another without their password. This will perform a search for the file «830.desktop» in our personal folderIn other words, if the file is in the personal folder of another user, it will not be found. If what we want is to find the file 830.desktop, we will write the following command: grep 830.desktop
0 Comments
Leave a Reply. |