grep via NodeJS
- Syntax follows general Unix command lines rules
- Option can be placed at any position (
grep -x ### /path/to/file
orgrep ### -x /path/to/file
orgrep ### /path/to/file -x
) - File path defined as console argument has higher priority under linux pipe syntax (if
cat /path/one | grep -x ### /path/two
, then/path/two
will be used as input) - Quotes behaviours: not required for single word search, double and single quoted text treated the same (
grep ### /path/to/file -x
orgrep '###' /path/to/file -x
orgrep "###" /path/to/file -x
)
- without parameters: output lines with keyword highlighted, case-sensitive (
grep ### /path/to/file
) -i
: case-insensitive search-v
: exclusive search, output lines, which not contains the keyword-c
: output count of found lines with provided keyword-n
: output highlighted line numbers along with text lines- parameters combinations
- NodeJS >= 12 (tested), possibly can work with v11
See Linux grep examples: