grepit

1.0.0 • Public • Published

grepit

Build Status

NPM

Description

Grep Module for Node

Syntax

grep(pattern, file)

Parameters

pattern

RegExp or String to be searched for. (aka. the 'needle')

file

String - path and filename of file to be searched. (aka. the 'haystack')

Output

Returns an array. The elements of the array will be the lines in which the pattern appears.

Usage

Installation

$ npm install grepit

test_file.txt:

The first sentence of the text.
Now the second sentence.
Why not a third, a third that has a comma in it.
And then comes the fourth sentence.

Example

 
var grepit = require('grepit');
 
var result = grepit(/first/, 'test_file.txt');
 
// result = [ 'The first sentence of the text.' ]
 

Readme

Keywords

Package Sidebar

Install

npm i grepit

Weekly Downloads

390

Version

1.0.0

License

MIT

Last publish

Collaborators

  • jonathanprince