14,982
edits
| Line 92: | Line 92: | ||
* {{kbd | key = <nowiki>awk '/pattern1/&&/pattern2/' file_name </nowiki>}} for {{Linux}} | * {{kbd | key = <nowiki>awk '/pattern1/&&/pattern2/' file_name </nowiki>}} for {{Linux}} | ||
* {{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 | ||
=== Search text in single plain text file === | |||
Search text in a file | |||
* grep command: {{kbd | key= grep ''keyword'' /path/to/file}} ({{Linux}}) | |||
* vim: (1)[http://www.tuxfiles.org/linuxhelp/vimcheat.html vim] <nowiki>[options]</nowiki> ''filename'' (2)press {{kbd | key= /keyword}} ({{Linux}}) | |||
* cat & grep: {{kbd | key= cat /path/to/file <nowiki>|</nowiki> grep ''keyword''}}: keyword is case sensitive ({{Linux}})<ref>[https://www.digitalocean.com/community/tutorials/using-grep-regular-expressions-to-search-for-text-patterns-in-linux#regular-expressions Using Grep & Regular Expressions to Search for Text Patterns in Linux | DigitalOcean]</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> | |||
== file name or folder name search == | == file name or folder name search == | ||