14,982
edits
| Line 97: | Line 97: | ||
=== Search text in single plain text file === | === Search text in single plain text file === | ||
Search text in a file | Search text in a file | ||
* grep command: {{kbd | key= grep | * grep command: | ||
** case insensitive<ref>[http://droptips.com/using-grep-and-ignoring-case-case-insensitive-grep Using grep and Ignoring Case (Case Insensitive grep)]</ref>: Using {{kbd | key=<nowiki>grep -i keyword /path/to/file</nowiki>}} ({{Linux}}) or enclose it in double quotes if the keywords contains spaces {{kbd | key=<nowiki>grep -i "keywords contains space" /path/to/file</nowiki>}} | |||
** case sensitive: {{kbd | key=<nowiki>grep keyword /path/to/file</nowiki>}} ({{Linux}}) | |||
* vim: (1)[http://www.tuxfiles.org/linuxhelp/vimcheat.html vim] <nowiki>[options]</nowiki> ''filename'' (2)press {{kbd | key= /keyword}} ({{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> | * 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> | ||
** big file search: | ** case insensitive: Using {{kbd | key=<nowiki> cat /path/to/file | grep -i keyword</nowiki>}} ({{Linux}}) or enclose it in double quotes if the keywords contains spaces {{kbd | key=<nowiki>cat /path/to/file | grep -i "keywords contains space"</nowiki> }} | ||
** case sensitive: {{kbd | key=<nowiki>cat /path/to/file | grep keyword</nowiki>}} ({{Linux}}) | |||
other issues | |||
* big file search: | |||
* Regular expression: supported | |||
* refine the search: | |||
Search text in a compressed text file | Search text in a compressed text file | ||