Skip to content

Latest commit

 

History

History
1021 lines (860 loc) · 38.2 KB

ARGUMENTS.md

File metadata and controls

1021 lines (860 loc) · 38.2 KB

cat_win

Simple Command-line Tool made in Python
Explore the code »

Report Bug · Request Feature

Table of Contents
  1. Arguments & Options

> catw [FILE]... [OPTION]...
> catw --help
> cats [OPTION]...
> cats --help

Arguments & Options

Argument / Option Description works in shell
-h, --help show help message and exit
-v, --version output version information and exit
--debug, --debug show debug information
-l, --linelength display the length of each line
-n, --number number all output lines
--fp, --file-prefix include the file in every line prefix
-e, --ends display $ at the end of each line
--chr, --char display special characters
-b, --blank hide empty lines
-p, --peek only print the first and last lines
-r, --reverse reverse output
-u, --unique suppress repeated output lines
--sort, --sort sort all lines alphabetically
--sf, --specific-format sort all lines alphabetically
-E, --echo handle every following parameter as stdin
-i, --interactive use stdin
-o, --oneline take only the first stdin-line
-U, --url display the contents of any provided url
-f, --files list applied files and file sizes
-d, --dirs list found directories
-s, --sum show sum of lines
-w, --wordcount display the wordcount
-g, --grep only show lines containing queried keywords or patterns
--nk, --nokeyword inverse the grep output
--nb, --nobreak do not interrupt the output
-a, --attributes show meta-information about the files
-m, --checksum show the checksums of all files
--b64d, --b64d decode the input from base64
--b64e, --b64e encode the input to base64
--eval, --EVAL evaluate simple mathematical equations
--hex, --HEX convert hexadecimal numbers to binary, octal and decimal
--dec, --DEC convert decimal numbers to binary, octal and hexadecimal
--oct, --oct convert octal numbers to binary, decimal and hexadecimal
--bin, --BIN convert binary numbers to octal, decimal and hexadecimal
--binview, --binview display the raw byte representation in binary
--hexview, --HEXVIEW display the raw byte representation in hexadecimal
-!, --edit open each file in a simple editor
-c, --clip copy output to clipboard
--dot, --dotfiles additionally query and edit dotfiles
--plain, --plain-only ignore non-plaintext files automatically
--nc, --nocolor disable colored output
--config, --config change default parameters
--cconfig, --cconfig change color configuration
-R, --R<stream> reconfigure the std-stream(s) with the parsed encoding
<stream> = 'in'/'out'/'err' (default is stdin & stdout)
enc=X, enc꞉X set file enconding to X (default is utf-8)
find=X, find꞉X find/query a substring X in the given files
match=X, match꞉X find/query a pattern X in the given files
trunc=X꞉Y, trunc꞉X꞉Y truncate file to lines X and Y (python-like)
[a,b] replace a with b in every line (escape chars with '\')
[a꞉b꞉c] python-like string indexing syntax (line by line)

General Information

  • Order of Operation
    • Files will be used in the same Order as they were provided.
    • When passing in a File-pattern or a Directory the Files will be used in the Order in which they were found. This will often be alphabetically, although this is not guaranteed.
    • URLs will be used in the Order as they were provided, after all Files have been displayed.
    • Arguments will for the most part be used in the same Order as they were provided, yet there are some Exceptions.
  • Case-Sensitivity
    • The Arguments are case-sensitive.
    • Some Arguments have slightly different Behaviour when using upper- or lowercase Letters.
  • Chaining
    • One-letter Arguments can be chained together (e.g. -l -n -c is equivalent to -lnc)
  • Input Order
    • No specific Order for passing in Arguments or Files is neccessary.
    • Arguments, Files and Urls may be passed in without any Rules to ordering (e.g. catw file1 -argument url -argument2 file2).
    • If the same Argument is passed in multiple times only the first occurence is being counted.
  • Unknown Files
    • When encountering unknown Files the User is being prompted to write to Stdin.
    • The Stdin is being used to then write the Files.
    • When using the --interactive Parameter unknown Files will be automatically written with the content of Stdin.
  • Coloring
    • The Output will contain Color by Default.
    • cat_win will not explicitly add Color if the Argument --nc, --nocolor is used. (The Output may still contain Color if a File itself contains the ANSI-Color-Coding.)
    • The Output will be stripped of any Color if the Output is piped and the Configuration strip_color_on_pipe is set to true .

Displays the help Message. This Message is for the most part equivalent to the Table above. The Code execution will stop after showing this Message. This Argument has Priority over all other Arguments, hence the Order of passing this Argument in makes no Difference. If no Arguments or Files are provided, the help Parameter will be used by Default.

Displays a short Message containing basic Information about the Code. This includes the version Number but also the installation Directory. The Code execution will stop after showing this Message.

> catw -v

------------------------------------------------------------------------------
Catw <Version> - from <Path>
------------------------------------------------------------------------------

Built with:     Python <PyVersion>
Install time:   YYYY-MM-DD HH:MM:SS
Author:         Silas A. Kraume

Displays debug Information before and after the Code execution. This Argument is not shown in the default help Message and is provided for Developers/Development.

Numbers all Lines. The Numberisation is done at the Beginning such that different Arguments may disorganize the Numberisation again. Each File starts with line Number 1 therefor multiple Files are not consecutively numbered. If multiple Files are provided, the Prefix will also include the Number of the File.

> catw test.txt -n
1) line 1
2) line 2
> catw test.txt test.txt -n
1.1) line 1
1.2) line 2
2.1) line 1
2.2) line 2

Displays the Length of each Line as a Prefix to the Line itself. This Argument will be used at the end such that other Arguments may influence the Length of the Lines beforehand.

> catw test.txt -l
[ 6] line 1
[10] long_line!

Shows the Path to the File in each Line prefix. This can be useful when querying for Substrings or Patterns such that only a few Lines are being displayed. Using this Argument in uppercase (--FP, --FILEPREFIX) will result in the Path being shown as the url file Protocol. This can be useful in case the Terminal supports interacting with Links such that the File can be instantly opened. Using the lowercase Argument in Combination with the -n, --number Parameter a GNU-style link format will be displayed.

> catw test.txt --fp
<Path>/test.txt line 1
<Path>/test.txt line 2
> catw test.txt --FP -n
1) file:///<Path>/test.txt line 1
2) file:///<Path>/test.txt line 2
> catw test.txt --fp -n
<Path>/test.txt:1 line 1
<Path>/test.txt:2 line 2

Displays a '$' Character at the End of each Line. This can be useful to detect Whitespaces.

> catw test.txt --ends
Tab:    $
line 2$

Replaces every special Character with a readable Token. Each Token starts with the '^' Character, followed by a short ASCII Descriptor. Note that the special Char ␛ will not be displayed as ^ESC because it is needed for the colored output.

> catw test.txt
�����    �  
> catw test.txt --chr
^SUB^SUB^NUL^SUB^SUB^TAB^BEL

Removes empty Lines from the Output. Beware that other Arguments can change a Line to be not empty beforehand.

> catw test.txt -nb
1) Empy Line follows:
3) Empty Line just got skipped!

Only displays the first and last 5 Lines of each File. Between the Beginning and End of the File will be displayed how many Lines have been skipped. Useful for getting a quick impression of how data in a given File is structured. This Argument is not being used when provided alongside with Queries for Substrings of Patterns. Does nothing when the File has at most 10 Lines.

> catw test.txt -p
Line 1
Line 2
Line 3
Line 4
Line 5
  :
  10
  :
Line 16
Line 17
Line 18
Line 19
Line 20

Simply reverses the Content of all Files as well as the Ordering of all Files themselves.

> catw test1.txt test2.txt -p
Line 2 From Test2
Line 1 From Test2
Line 2 From Test1
Line 1 From Test1

Suppresses repeated Lines if they occur exactly one after the other.

> catw test.txt
This is a line!
This is a line!
This is a line!
This is also a line!
This is a line!
> catw test.txt --unique
This is a line!
This is also a line!
This is a line!

Sorts the Output alphabetically without case sensitivity.

> catw test.txt --sort -n
2) A line that has been sorted to the top!
1) This line was originally at the top!

Automatically format specific File Types. Currently supported are .json and .xml.

> catw --sf -E '{"person":{"name":"Alice","age":25,"employees":[{"name":"Bob"},{"name:":"David"}]}}'
{
  "person": {
    "name": "Alice",
    "age": 25,
    "employees": [
      {
        "name": "Bob"
      },
      {
        "name:": "David"
      }
    ]
  }
}
> catw --sf -E '<lib><book id="1"><title>Cats</title></book><book id="2"></book></lib>'
<?xml version="1.0" ?>
<lib>
  <book id="1">
    <title>Cats</title>
  </book>
  <book id="2"/>
</lib>

Everything passed in after this Argument will be handled as its own File. It is not possible to break out of this state therefor this Parameter must be used last. When using the one-letter Variant of this Parameter the following Input will be decoded with unicode Escape Sequences instead of parsing a raw String. This way it is possible to define new lines (\n) or other special characters.

> catw -l -E -n The last 'Parameter' does not count!
[37] -n The last Parameter does not count!

Using this Argument allows to pass in Data via the Stdin Stream. The Stdin Pipe will be handled as its own File.

> echo Hello World! | catw -in
1) Hello World!

Limits the Stdin Stream to the first Line. Can only be used in Combination with -i, --interactive.

> catw test.txt
Line 1
Line 2
Line 3
> catw test.txt | catw -io
Line 1

When using this Parameter it is possible to provide URLs as Arguments. Should an URL not have a scheme (http(s):// or fttp(s):// ...) the default scheme (https://) is being used. Provided URLs are simply curl'd and handled as its own File. When not providing a raw Data URL the Content will include the HTML Elements.

> catw -U https://github.com/SilenZcience/cat_win > cat.html

Displays a small Summary at the End of Code execution showing every File used and their file Size. Using this Argument in uppercase (-F, --FILES) will ONLY display the Summary and stop Code execution.

> catw test.txt -f
Line 1
Line 2

applied FILE(s):
        13.0 B   <Path>/test.txt
Sum:    13.0 B
Amount: 1
> catw test.txt --FILES
applied FILE(s):
        13.0 B   <Path>/test.txt
Sum:    13.0 B
Amount: 1

Displays a small Summary at the End of Code execution showing every Directory found. Using this Argument in uppercase (-D, --DIRS) will ONLY display the Summary and stop Code execution.

> catw ./** -d
Line 1
Line 2
...

found DIR(s):
        <Path>
        <Path>/<PathA>
        <Path>/<PathA>/<PathAA>
        <Path>/<PathB>
Amount: 4
> catw ./** -D
found DIR(s):
        <Path>
        <Path>/<PathA>
        <Path>/<PathA>/<PathAA>
        <Path>/<PathB>
Amount: 4

Displays a small Message at the End of Code execution showing the Number of the Amount of all Lines received. Using this Argument in uppercase (-S, --SUM) will ONLY show this Message as well as a small Summary. This Summary will show the line Sum for each File. Duplicate Files will not be displayed multiple times within the Summary. The uppercase version of this Parameter will stop Code execution.

> catw test.txt --sum
Line 1
Line 2

Lines (Sum): 2
> catw test.txt test.txt --SUM
File             LineCount
<Path>/test.txt  2

Lines (Sum): 4

Displays a Summary of all Tokens/Words found in the given Files and how frequent they occured. The Output will be sorted by the Frequency of Occurrence starting with the most common Word. In Addition the used Files will be displayed beforehand. Using this Argument in uppercase (-W, --WORDCOUNT) will ONLY display this Message and stop Code execution.

> catw test.txt
it is true for all that, that that 'that' which that 'that' refers to is not the same 'that' which that 'that' refers to
> catw test.txt -W
The word count includes the following files:
    <Path>

that: 9
': 8
is: 2
refers: 2
to: 2
which: 2
,: 1
all: 1
for: 1
it: 1
not: 1
same: 1
the: 1
true: 1

Skips every Line that does not contain any matched Patterns or queried Substrings. Literals or Patterns to look for can be set using the find=X, find꞉X and match=X, match꞉X Keywords. Using this Argument in uppercase (-G, --GREP) will ONLY display the parts of each Line that matched any Pattern or Literal. Should multiple Queries be found in the same Line they will be seperated by comma. The uppercase Variant of this Parameter has priority (over the lowercase Variant as well as --nk, --nokeyword).

> catw test.txt find=cat -gn
1) cat_win!
4) one cat!& two cat!& three cat
> catw test.txt match=.cat. -Gn
4)  cat!, cat!

Inverse to the -g, --grep Argument. Skips every Line that does contain any matched Patterns or queried Substrings. The Combination of --nokeyword and -g, --grep means that no Output will be displayed.

> catw test.txt find=cat -n --nk
2) This Line is boring
3) This Line also does not contain 'c a t'
5) This Line neither

Using this Argument will open non-plaintext Files automatically without prompting the User. In Addition the Output will not stop on queried Substrings or Patterns. This Behaviour is included by Default when using --nk, --nokeyword or -g, --grep.

Shows meta Information for each File provided and stops Code execution. The meta Information includes file Size, Time of Access, -Modified and -Created. On Windows OS Systems this Parameter will also display the classic file Attributes.

> catw test.txt -a
<Path>/test.txt
Size:           1.55 KB
ATime:          YYYY-MM-DD HH:MM:SS.
MTime:          YYYY-MM-DD HH:MM:SS.
CTime:          YYYY-MM-DD HH:MM:SS.
+Archive, Indexed
-System, Hidden, Readonly, Compressed, Encrypted

Shows different Checksums for each File provided and stops Code execution. The displayed Checksums include CRC32, MD5, SHA1, SHA256 and SHA512.

> catw test.txt -m
Checksum of '<Path>/test.txt':
        CRC32:   F67C071D
        MD5:     95de18c87649e804c15ccdd73ae6eddc
        SHA1:    cecdcba1cd12a9fdfdb32a1aa1bc40bdb9b1261c
        SHA256:  1d4bf9f69b9d1529a5f6231b4edeba61a86deeebf00060c4de6f67f0c4e3b711
        SHA512:  db9a71ef22360f171daa4e4aed033337f4f97812baf38a51bdd6ed64b5c2a0d4a5c4152e20b68f881df9e5f1087c1293853eac13f928b845b9b71c3ce517c9e3

Decodes a Base64 encoded Input and continues Code execution with the decoded Text. This Parameter will be used before most other Arguments such that other Parameters will be used on the decoded Text. This means a Base64 encoded Input is expected and neccessary.

> echo SGVsbG8gV29ybGQ= | catw -i --b64d
Hello World

Encodes a given Text in Base64. This Parameter will be used after most other Arguments such that other Parameter will be used on the plain Text beforehand.

> echo Hello World | catw -i --b64e
SGVsbG8gV29ybGQ=

Evaluates simple mathematical Expressions within any given Text. The mathematical Expressions may consist of paranthesis, Operators including Modulo (%) and Exponential (**), as well as any Number in Hexadecimal, Decimal, Octal or Binary. The evaluated Value of the Expression will by default be inserted back into the Position of the Text where the Expression was found. In the uppercase Variant of the Parameter any non-mathematical Text will be stripped thus only evaluated Expressions will remain. On Error The Expression will evaluate to '???'.

> echo Calculate: (5 * 0x10 * -0b101) % (0o5 ** 2) ! | catw -i --eval
Calculate: 0 !
> echo Calculate: (5 * 0x10 * -0b101) % (0o5 ** 2) ! | catw -i --EVAL
0

If a Line only contains a hexadecimal Number this Parameter will append the equivalent Value in Binary, Octal and Decimal. Negative Numbers are allowed. Numbers are allowed to start with the Prefix 0x. When using the uppercase Variant (--HEX) the Numbers will not include their Prefixes (like 0x, 0b or 0o).

> catw test.txt --hex
FF [Bin: 0b11111111, Oct: 0o377, Dec: 255]
0x610 [Bin: 0b11000010000, Oct: 0o3020, Dec: 1552]
> catw test.txt --HEX
FF [Bin: 11111111, Oct: 377, Dec: 255]
0x610 [Bin: 11000010000, Oct: 3020, Dec: 1552]

If a Line only contains a decimal Number this Parameter will append the equivalent Value in Binary, Octal and Hexadecimal. Negative Numbers are allowed. When using the uppercase Variant (--DEC) the Numbers will not include their Prefixes (like 0x, 0b or 0o).

> catw test.txt --dec
255 [Bin: 0b11111111, Oct: 0o377, Hex: 0xff]
1552 [Bin: 0b11000010000, Oct: 0o3020, Hex: 0x610]
> catw test.txt --DEC
255 [Bin: 11111111, Oct: 377, Hex: ff]
1552 [Bin: 11000010000, Oct: 3020, Hex: 610]

If a Line only contains an octal Number this Parameter will append the equivalent Value in Binary, Decimal and Hexadecimal. Negative Numbers are allowed. Numbers are allowed to start with the Prefix 0o. When using the uppercase Variant (--OCT) the Numbers will not include their Prefixes (like 0x, 0b or 0o).

> catw test.txt --oct
0o377 [Bin: 0b11111111, Dec: 255, Hex: 0xff]
3020 [Bin: 0b11000010000, Dec: 1552, Hex: 0x610]
> catw test.txt --OCT
0o377 [Bin: 11111111, Dec: 255, Hex: ff]
3020 [Bin: 11000010000, Dec: 1552, Hex: 610]

If a Line only contains a binary Number this Parameter will append the equivalent Value in Octal, Decimal and Hexadecimal. Negative Numbers are allowed. Numbers are allowed to start with the Prefix 0b. When using the uppercase Variant (--BIN) the Numbers will not include their Prefixes (like 0x, 0b or 0o).

> catw test.txt --bin
11111111 [Oct: 0o377, Dec: 255, Hex: 0xff]
0b11000010000 [Oct: 0o3020, Dec: 1552, Hex: 0x610]
> catw test.txt --BIN
11111111 [Oct: 377, Dec: 255, Hex: ff]
0b11000010000 [Oct: 3020, Dec: 1552, Hex: 610]

Displays a BinaryViewer for each File passed in. Special Characters like NewLine or BackSpace will be displayed as specific readable Chars if the Font and the Encoding do support that Behaviour.

> catw test.txt --hexview
<Path>\test.txt:
Address  00       01       02       03       04       05       06       07       08       ... # Decoded Text
00000000 01000011 01100001 01110100 01011111 01010111 01101001 01101110 00100001 00001010 ... # C a t _ W i n ! ␤

Displays a Hexviewer for each File passed in. Special Characters like NewLine or BackSpace will be displayed as specific readable Chars if the Font and the Encoding do support that Behaviour. When using the uppercase Variant of this Parameter (--HEXVIEW) the hexadecimal Numbers within the Hexviewer will also be uppercase.

> catw test.txt --hexview
<Path>\test.txt:
Address  00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F # Decoded Text
00000000 48 65 6c 6c 6f 20 57 6f 72 6c 64 20 46 72 6f 6d # H e l l o   W o r l d   F r o m
00000010 20 43 61 74 21 0a                               #   C a t ! ␤
> catw test.txt --HEXVIEW
<Path>\test.txt:
Address  00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F # Decoded Text
00000000 48 65 6C 6C 6F 20 57 6F 72 6C 64 20 46 72 6F 6D # H e l l o   W o r l d   F r o m
00000010 20 43 61 74 21 0A                               #   C a t ! ␤

By default the User is being prompted when a non-plaintext File is being encountered as to if the File should be opened in Binary or not. Using --plain-only these Files will be automaticaly skipped. Note that these Prompts are not descriptive enough to say that a File can only be opened in Binary. Often the Problem is being fixed by providing another Codepage using the enc=X, enc꞉X Parameter.

When providing file Patterns or entire Directories cat_win will find every File including those set to hidden (e.g. on Windows OS). However Dotfiles, meaning Files that start with a literal Dot, will not be found by Default. Using this Parameter cat_win will also include Dotfiles.

> catw * -F
found FILE(s):
        12.35 KB   <Path>/CHANGELOG.md
        1.06 KB    <Path>/LICENSE
        15.07 KB   <Path>/README.md
...
> catw * -F --dot
found FILE(s):
        969.0 B    <Path>/.gitignore
        12.35 KB   <Path>/CHANGELOG.md
        1.06 KB    <Path>/LICENSE
        15.07 KB   <Path>/README.md
...

By default different Colors will be used to better highlight specific Parts of the Output or make original and changed Parts of a Line more distinguishable. Using --nocolor will disable all Colors and only display the Output in plain monochrome Text.

Opens a simple Editor to write/edit the Content of any provided File one by one. Not-existing Files will be opened first and existing Ones will be able to be edited after that. The Editor will not save Changes automatically. Files will be saved with the text Encoding defined by enc=X, enc꞉X. Note that ^c (Ctrl-c) is reserved for the KeyboardInterrupt meaning that it will stop the entire Program instantly. On Windows this Feature uses the windows-curses Module. The currently supported Key bindings are as follows:

Key(s) default behaviour shift click control click alt click
Arrows move cursor by char scroll window by char move cursor by word move cursor by char
Page Up/Down move cursor by page scroll window by page move cursor by page move cursor by page
Home/Pos move cursor to start of line scroll window to start of file move cursor to start of file move cursor to start of line
End move cursor to end of line scroll window to end of file move cursor to end of file move cursor to end of line
Enter write newline write newline write newline -
Backspace delete char on the left delete char on the left delete word on the left delete char on the left
Delete delete char on the right delete char on the right delete word on the right delete char on the right
Undo/^Z - - undo an action -
Redo/^Y - - redo an action -
Save/^S - - save changes -
Close/^Q - - close editor
(prompt to save, if neccessary)
-
Interrupt/^C - - interrupt program -

Copies the entire Output to the Clipboard additionally to printing it to the Stdout Stream.

Displays a user interactive config Menu allowing the User to change specific default parameters. Stops Code execution after finishing the Configuration. The config File will be saved to the installation Directory of cat_win which is by Default the Python directory. This means that uninstalling cat_win may result in the config File being left over. When using the Windows Executables this Parameter will have no (long term) Effect. Valid Options are:

Option Description Example Default
default_command_line custom Command Line containing Parameters
used additionally to the specific Parameters
of the Program Call
-n 'find= '
default_file_encoding the File Encoding used by Default utf-16 utf-8
large_file_size the Size (Bytes) at which a Warning occurs. 1024 104857600 (100Mb)
strip_color_on_pipe indicate if the Output should be stripped of any Color no true

Displays a user interactive config Menu allowing the User to change the Colors for specific Elements and Arguments. Stops Code execution after finishing the Configuration. The config File will be saved to the installation Directory of cat_win which is by Default the Python directory. This means that uninstalling cat_win may result in the config File being left over. When using the Windows Executables this Parameter will have no (long term) Effect. Valid Options are:

Option Description
line_numbers the numbering of each line using '-n'
line_length the display of each line length using '-l'
file_prefix the file prefix using '--fp'
line_ends the end of line marker using '-e'
special_chars special chars using '--chr'
number_conversion the converted values using '--bin'/'--oct'/'--hex'/'--dec'
number_evaluation the evaluated value using '--eval'
substring_replacement the replaced string using '[a,b]'
found_keyword the found substring using 'find=x'
found_keyword_message the message displayed when using 'find=x'
matched_pattern the matched pattern using 'match=x'
matched_pattern_message the message displayed when using 'match=x'
checksum_message the calculated checksum of a given file using '-m'
processed_message the message displayed using '-f'/'-d'/'-s'/'-w'
active_file_attributes the attributes a file has set using '-a'
missing_file_attributes the attributes a file has not set using '-a'
file_attribute_message the message containing time stamps and file size using '-a'
raw_viewer the output using '--hexview'/'--binview'
message_information any informational message like update information
message_important any important message like large file sizes
message_warning any warning message like overwriting a file with itself

Python uses Utf-8 to encode the Streams by default. On Windows OS the Encoding may even be Cp1252. The Encoding can be influenced externally by setting the environment Variable PYTHONIOENCODING to the desired Encoding, or setting the environment Variable PYTHONUTF8 to 1. In any case it is often useful to have the stream Encoding variable if a File for example is written in another Codepage like Utf-16. Using this Parameter allows for specific Stream Reconfiguration meaning setting the Encoding for interpreting the Streams. The Encoding used is defined by the enc=X, enc꞉X Argument. By Default Stdout and Stderr are reconfigured. Valid Streams are Stdout (--Rout), Stdin (--Rin) and Stderr (--Rerr). When encountering UnicodeErrors the Problem is most likely being fixed by using -R (or --Rout).

> catw ./CHANGELOG.md > test.txt
UnicodeEncodeError: 'charmap' codec can't encode character ...
> catw ./CHANGELOG.md --Rout > test.txt

Sets the text Encoding that is being used to read and write Files. Valid Options are defined by the Python Interpreter used (e.g. for Python3.10). The default Encoding is Utf-8.

> catw test.txt
Failed to open: <Path>\test.txt
Do you want to open the file as a binary, without parameters?
[Y/⏎] Yes, Continue       [N] No, Abort :
> catw test.txt enc=utf-16
This Text is written in Utf-16!

Defines a Literal to search for within the Text of any provided File. When the Literal contains Whitespaces it is neccessary to encase the entire Parameter with Quotes as defined by the Terminal used. It is possible to define multiple Substrings to search for by simply providing the Parameter find=X multiple times.

> catw test.txt "find=cats and"
It's raining cats and dogs!
--------------- Found [('cats and', [13, 21])] ---------------

Defines a Pattern to search for within the Text of any provided File. It is possible to define multiple Patterns to match for by simply providing the Parameter match=X multiple times. The given Patterns is simply treated as a regular Expression.

> catw test.txt "match=cat.\s.{3,}"
It's raining cats and dogs!
--------------- Matched [('cat.\\s.{3,}', [13, 27])] ---------------

Truncates every File by the Specifics defined. This Parameter uses the default Python slicing Mechanic and uses it on the Lines of each File. The Argument is valid by defining trunc=<start>:<stop> or trunc=<start>:<stop>:<step>

> catw test.txt trunc=5:-5:2
 6) Line 6
 8) Line 8
10) there are 5 more Lines following this one

Replaces the Substring defined by a with the Substring b in every Line of Every File. Characters within one of the two Substrings can be escaped using a Backslash. For example this way it is possible to replace a comma which is also used as the delimeter of both Strings. When one of the Substrings contains Whitespaces it is neccessary to encase the entire Parameter with Quotes as defined by the Terminal used. It is possible to define multiple replace Arguments.

> catw test.txt "[\,,X]" "[\\,/]"
This is a comma: X
This is a Backslash: /

Similiar to the trunc=X:Y parameter this Argument is used on each Line individually. Every Line is being cut down as specified by the Elements within the Argument [<start>:<stop>:<step>].

> catw test.txt [2::2]
2468acegikmoqsuwy