Command line regular expression search and replace
Search and replace on the command line using Javscript regular expressions.
A handy replacement to
$ npm install -g xp
Usage: xp [-ialo] <search pattern> [replace pattern] [--] [files...]Options:-h, --help output usage information-V, --version output the version number-i, --insensitive perform case-insensitive searching-a, --all perform search (and replace) on whole input-l, --lines show the filename and line number for matches-O, --only-matching-lines show only the lines that match-o, --only-matching show only the portion of the search text that matched<search_pattern> the search pattern[replace_pattern] the replacement pattern[files...] one or more files to readRemarks:The search pattern defaults to line-by-line matching by default.Specifying `-a' will cause the input to be matched in whole (inverse of the /.../mflag), though will cause the entire input to be buffered in memory prior toperforming a match.If no replacement pattern is provided, and filenames are to be specified, `--' mustcome after the search pattern and before the command line arguments. It is innocuousto have it when using both a replacement pattern and a list of files.If no files are specified, or if a single hyphen (`-') is specified as a file, thenstandard input is read instead.The `--lines' flag only applies when `-a' is not specified and no replacement isbeing performed.The `--only-matching` flag only applies when no replacement is being performed.Bugs:For bug reports, updates, issues or feedback, please file an issue on GitHub:
$ echo 'hello' | xp -o .hello
$ echo 'hello' | xp h jjello
$ cat /usr/share/dict/propernames | xp -O 'Jean\-([A-Z][a-z]*)' 'Jean clan: $1'Jean clan: ChristopheJean clan: Pierre