Polonius Reader - rail5/polonius GitHub Wiki

% polonius-reader(1) Version 1.0 | Manual for the Polonius Reader

NAME

polonius-reader - outputs a selected portion of the contents of a file

SYNOPSIS

polonius-reader <file> [options]

$ polonius-reader ./file -s 50 -l 10
$ polonius-reader ./file -f "hello world"
$ polonius-reader ./file -f "hello world" -p
$ polonius-reader ./file -f "[A-Z]+[0-9]{2}" -e

OPTIONS

  • -s, --start - Start reading from a specific position in the file
  • -l, --length - Read a specific number of characters from the start position
  • -f, --find - Search for a specific string in the file
  • -e, --regex - Interpret the search string as a regular expression
  • -b, --block-size - Set the block size for reading the file
  • -p, --position - Output start and end position rather than text
    • If -f is set, this will output the position of the found match
  • -c, --special-chars - Enable special character processing in search strings
  • -V, --version - Show version and exit
  • -h, --help - Show help and exit

START POSITION

Specifying the "start position" tells Polonius to skip over the beginning of the file and only start reading at the position you specify.

If the start position is not specified, it defaults to position 0 (the beginning of the file)

READ LENGTH

Specifying the "read length" tells Polonius to only read X number of characters from the start position

If the read length is not specified, Polonius will read until the end of the file

SEARCH

A search can be done with the -f option. For example: polonius-reader ./file -f "hello world"

If this is combined with Start Positions or Read Lengths, the search will happen only within those boundaries. For example, polonius-reader ./file -f "hello" -s 500 -l 200 will search for the string "hello" only between character #500 and character #700

This can also be combined with the "Output Positions" (-p) option. If the "Output Positions" flag is set with -p, Polonius will tell you where it found a match, in the space-delimited format startposition endposition (for example: 510 515).

By default, without the -p flag, Polonius will output the match itself.

REGEX SEARCH

A normal search can be made into a regex search by passing the -e option. For example: polonius-reader -f "[a-z]+[0-9]{2}" -e

Polonius is not capable of finding regex matches which are larger than the block size (default 10KB if unspecified).

BLOCK SIZE

Specifying the "Block Size" tells Polonius how much data from the file we're willing to load into memory at once.

The default value (if unspecified) is 10 kilobytes

The block size can be specified with the -b option, in the formats:

  1. -b 15 (This would set the block size to 15 bytes)

  2. -b 16K (This would set the block size to 16 kilobytes)

  3. -b 17M (This would set the block size to 17 megabytes)

  4. -b 18G (This would set the block size to 18 gigabytes)

This option is common to both polonius-reader and polonius-editor

OUTPUT POSITIONS

Setting the "Output Positions" flag tells Polonius to not output the actual content of the file, but instead to tell you the start and end positions of the content that it would've outputted.

The flag can be set with the -p option. Polonius will output the positions in the space-delimited format startposition endposition, for example: 10 15

SPECIAL CHARACTERS

Setting the "special characters" flag tells Polonius to parse escaped character sequences in search queries. Polonius will parse \n, \t, \\, and \x00 through \xFF.

The special characters flag can be set with the -c option.

⚠️ **GitHub.com Fallback** ⚠️