14,982
edits
(+Search text in multiple compressed files) |
|||
| Line 96: | Line 96: | ||
* {{kbd | key = <nowiki>grep -E 'pattern1.*pattern2|pattern2.*pattern1' file_name </nowiki>}} {{exclaim}} order dependent | * {{kbd | key = <nowiki>grep -E 'pattern1.*pattern2|pattern2.*pattern1' file_name </nowiki>}} {{exclaim}} order dependent | ||
* {{kbd | key = <nowiki>cat file_name | grep -E 'pattern1.*pattern2|pattern2.*pattern1' </nowiki>}} {{exclaim}} order dependent | * {{kbd | key = <nowiki>cat file_name | grep -E 'pattern1.*pattern2|pattern2.*pattern1' </nowiki>}} {{exclaim}} order dependent | ||
=== Search text in single plain text file === | === Search text in single plain text file === | ||
| Line 117: | Line 113: | ||
* refine the search: | * refine the search: | ||
Search text in a compressed text file | === Search text in multiple compressed files === | ||
* Switch to the folder & keyin the command {{kbd | key=<nowiki>find . -name "error*.gz" | xargs zcat | grep "pattern"</nowiki>}} to search the {{kbd | key=<nowiki>error*.gz</nowiki>}} files contains specified pattern <ref>[https://stackoverflow.com/questions/1253816/find-string-inside-a-gzipped-file-in-a-folder linux - find string inside a gzipped file in a folder - Stack Overflow]</ref> | |||
=== Search text in a compressed text file === | |||
* zcat & grep: {{kbd | key= cat /path/to/compressed_text.gz <nowiki>|</nowiki> grep ''keyword''}} ({{Linux}})<ref>[http://www.cyberciti.biz/faq/unix-linux-cat-gz-file-command/ Unix / Linux: cat .GZ Compressed Text File On Screen]</ref> | * zcat & grep: {{kbd | key= cat /path/to/compressed_text.gz <nowiki>|</nowiki> grep ''keyword''}} ({{Linux}})<ref>[http://www.cyberciti.biz/faq/unix-linux-cat-gz-file-command/ Unix / Linux: cat .GZ Compressed Text File On Screen]</ref> | ||