Skip to content
/ snip Public

snip, cut, trim, chop: a lovechild of grep and sed.

License

Notifications You must be signed in to change notification settings

danmarg/snip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

snip

snip, cut, trim, chop: a lovechild of grep and sed.

Installation

$ GOPATH=$PWD go install github.com/danmarg/snip

Usage

snip can do some of what grep, sed, and cut can do, but with your familiar standard re2 regular expression language.

COMMANDS:
    match, m    [pattern] [file]? regular expression match
    replace, s  [pattern] [pattern] [file]? regular expression replace
    split, c    [pattern] [file]? split input lines

GLOBAL OPTIONS:
   --insensitive, -i    case insensitive
   --multiline, -m      multiline
   --dotall, -s         let . match \n
   --ungreedy, -U       swap meaning of x* and x*?, x+ and x+?
   --recursive, -r    recursive input

A few lame examples:

$ snip -h | snip m exp                                                                                             
    match, m    [pattern] [file]? regular expression match
    replace, s  [pattern] [pattern] [file]? regular expression replace
$ snip -h | snip s expression exposition | snip m exp                                                              
    match, m    [pattern] [file]? regular exposition match
    replace, s  [pattern] [pattern] [file]? regular exposition replace
$ snip -h | snip m , | snip c , -f 2                                                                               
 cut
 m      [pattern] [file]? regular expression match
 s      [pattern] [pattern] [file]? regular expression replace
 c      [pattern] [file]? split input lines
 -i     case insensitive
 -m     multiline
 -s             let . match \n
 -U     swap meaning of x* and x*?
 -h             show help
 -v     print the version
$ snip -h | snip s 'regular (\w+)' '${1} regular'|snip m regular                                                   
    match, m    [pattern] [file]? expression regular match
    replace, s  [pattern] [pattern] [file]? expression regular replace

About

snip, cut, trim, chop: a lovechild of grep and sed.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages