snip

command module
v0.0.0-...-9df3f33 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2016 License: MIT Imports: 10 Imported by: 0

README

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

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL