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 a stream editor, is used to perform basic text transformations from a file or from pipeline. It reads text, line by line, from a file and replace, insert or print all text or specific area.

EXAMPLES
Usage: pysed [OPTION] {patt} {repl} {lines/max/flag} [[input-file], --write] pysed is utility that parses and transforms text Optional arguments:
  -h, --help Print this help message 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
  -t, --stat Print text statistics
      --write Write changes to file

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

Replace part text throughout the text or the text in specific lines and quantities and if necessary use a flag. Example: $ printf "This is my cat,\n whose name is Betty.\nThis is my dog,\n whose name is Frank.\n" | pysed -r "nAme" "surname" 4/0/I This will replace the word 'name' in 'surname' in line 4 and ignore uppercase.

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

Scan through string looking for the all location where the regular expression pattern produces a match, and print text. Example: $ printf "This is my cat,\n whose name is Betty.\nThis is my dog,\n whose name is Frank.\n" | pysed -f "is" "" 3 This should print two words 'is is' from line 3.

  -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. Example: $ printf "This is my cat,\n whose name is Betty.\nThis is my dog,\n whose name is Frank.\n" | pysed -s "is" "" 3 This should print word 'is' from line 3.

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

Match text at the beginning of the string. Example: $ printf "This is my cat,\n whose name is Betty.\nThis is my dog,\n whose name is Frank.\n" | pysed -m "This" "" 3 This should print word 'This' from line 3.

  -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.

  --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

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

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

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

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

COPYRIGHT
Copyright © 2014-2015 Dimitris Zlatanidis

SEE ALSO
sed(1)