1.0.0 • Published 9 years ago

grepit v1.0.0

Weekly downloads
79
License
MIT
Repository
github
Last release
9 years ago

#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.' ]