pysed(10)

NAME
pysed is utility that parses and transforms text

SYNOPSIS
Usage: pysed [-h] [-v]
             [[-r] [-f] [-s] [-m] [-l] [-g] [-s] --write]

DESCRIPTION
pysed is utility that parses and transforms text

CLI utility that parses and transforms text written in Python. Pysed is a Python stream editor, is used to perform basic text transformations from a file. It reads text, line by line, from a file and replace, insert or print all text or specific area. Actually pysed is a passage of Python module 're' in terminal.

EXAMPLES
Usage: pysed [OPTION] {pattern} {repl} {lines/max/flag} [input-file] Options:
  -h, --help display this help and exit
  -v, --version print program version and exit
  -r, --replace search and replace text
  -f, --findall find all from pattern in text
  -s, --search search for the first matching
  -m, --match pattern matching in the beginning
  -l, --lines search pattern and print lines
  -g, --highlight highlight and print text
  -s, --stat print text statistics
      --write write changes to file

COLORS
 black, red, green, yellow, blue, magenta, cyan

FLAGS
 I or IGNORECASE
 M or MULTILINE
 S or DOTALL
 U or UNICODE
 L or LOCALE
 X or VERBOSE

GLOBAL OPTIONS

  -v, --version
Print the version of program and exit.

  -r, --replace, search and replace text
pysed -r "pattern" "replace" lines/max/flag input-file

Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl. If the pattern isn’t found, string is returned unchanged. repl can be a string or a function; if it is a string, any backslash escapes in it are processed. That is, is converted to a single newline character, is converted to a carriage return, and so forth. Unknown escapes such as j are left alone. Backreferences, such as 6, are replaced with the substring matched by group 6 in the pattern. Source: https://docs.python.org/2.7/library/re.html#re.sub

  -f , --findall, find all from pattern in text
pysed -f "pattern" "" lines/0/flags input-file

Return all non-overlapping matches of pattern in string, as a list of strings. The string is scanned left-to-right, and matches are returned in the order found. Empty matches are included in the result unless they touch the beginning of another match. Source: https://docs.python.org/2.7/library/re.html#re.findall

  -s , --search, search for the first matching
pysed -s "pattern" "" lines/group/flag input-file

Scan through string looking for the first location where the regular expression pattern produces a match, and print text. the string. Source: https://docs.python.org/2.7/library/re.html#re.search

  -m , --match, pattern matching in the beginning
pysed -m "pattern" "" lines/group/flag input-file

If zero or more characters at the beginning of string match the regular expression pattern, print matching text. Source: https://docs.python.org/2.7/library/re.html#re.match

  -l , --lines, search pattern and print lines
pysed -l "pattern" input-file

Same argument as the '--search' except that facing the file line by line and prints the line found in pattern.

  -g , --highlight, highlight and print text
pysed -g "pattern" "color" input-file

Print a file with an highlight on the pattern.

  -s , --stat, print text statistics
pysed -s input-file

Print text statistics split in lines, words, chars, blanks.

  -w , --write, write changes to file

Add this argument last to write the changes to the file.

HELP OPTION
Specifying the help option displays help for pysed itself, or a command.
For example:
  pysed --help - display help for pysed

AUTHOR
Dimitris Zlatanidis <d.zlatanidis@gmail.com>

HOMEPAGE
https://github.com/dslackw/pysed

COPYRIGHT
Copyright © 2014-2015 Dimitris Zlatanidis

SEE ALSO
sed(1)