I want to search for a particular string from a .gz file containing a text file without extracting in linux terminal. I know how to search for a string from a text file using grep "text to search" ./myfile.txt
. But how to make it work for .gz files?
相关问题
- Is shmid returned by shmget() unique across proces
- how to get running process information in java?
- Error building gcc 4.8.3 from source: libstdc++.so
- Why should we check WIFEXITED after wait in order
- Null-terminated string, opening file for reading
But this would only work if the .gz file contains text file which is true in your case.
You can use
zgrep
. Usage is similar togrep
.From the
man
page's description: