Home
Aitjcize edited this page Sep 14, 2010
·
3 revisions
CBASE(1) User Manuals CBASE(1)
NAME
cbase - A simple program for base convertion between numbers
SYNOPSIS
cbase [ -i input_base ] [ -o output_base ] [ OPTIONS ] NUM1 NUM2 ...
DESCRIPTION
cbase is a simple program designed to convert numbers between arbi‐
traraily bases.
There are two groups of options, one with lower case and another one
with upper case. The upper case options is used between terms while the
lower case is used between places. (since you can use arbitraraily
base, a place can have more then one digits.)
Note: If no argument specified, cbase will read from stdin.
OPTIONS
-i, --input-base INPUT_BASE
Inbase, the base of the given string. Base can range from 2 to
256, use 'a' to specify that the input string is ASCII charac‐
ters.
-o, --output-base OUTPUT_BASE
Outbase, like inbase, but specify the base of output string, use
'a' to output ASCII characters.
-a, --alphabet
use alphabet for base between 17 and 36
-d, --place-delimiter DELIM
Tell cbase that the terms delimited by DELIM is treated as a
single place. This is often used when the base is larger than
36. See the Example section for more information.
-D, --term-delimiter DELIM
Tell cbase that the terms delimited by DELIM should be processed
rescpectively.
-g, --group-place-by COUNT
The `-g' option is like the `-d' option, but instead of using a
delimiter, COUNT is used to group each terms. If neither `-d'
nor `-g' is specified, `-g 1' is assumed (Like ten-based num‐
bers). See the Example section for more information.
-G, --group-term-by COUNT
The `-G' option is like the `-D' option, but instead of using a
delimiter, COUNT is used to group each terms. See the Example
section for more information.
-f, --delimit-place-with DELIM
Delimit each place in the output string, this is especially use‐
ful when the `-g' option is used. See the Example section for
more information. By default, if the `-d' option is used, the
output string will be delimited with the same delimiter as the
input. You can also use this option to change the output delim‐
iter.
-F, --delimit-term-with DELIM
Delimit each term in the output string, this is especially use‐
ful when the `-G' option is used. See the Example section for
more information. By default, if the `-D' option is used, the
output string will be delimited with the same delimiter as the
input. You can also use this option to change the output delim‐
iter.
-s, --suppress-place-delimiter DELIM
Suppress place delimiter.
-S, --supress-term-delimiter DELIM
Suppress term delimiter.
-v, --version
show version information.
-h, --help
show this help message and exit
EXAMPLE
Input: cbase -i 10 -o 16 -D : 97:98:99
Output: 61:62:63
Input: cbase -i 256 -o 10 -d 168.128.0.1
Output: 2826960897
Input: cbase -i 10 -o 16 -go 2 979899
Output: 616263
Input: cbase -i 256 -o 10 -g 3 168128000001
Output: 2826960897
Input: cbase -i a -o 10 -F : NTUEE
Output: 78:84:85:69:69
Input: cbase -i a -o 10 -F -f . NTUEE
Output: 7.8|8.4|8.5|6.9|6.9
Input: cbase -i 10 -o 256 -s 2826960897
Output: 168128000001
Input: cbase -i a -o 16 -F % 'UTF-8 Encode!'
Output 55%54%46%2d%38%20%45%6e%63%6f%64%65%21
Input: cbase -i 16 -o a -D % -S %55%54%46%2d%38%20%44%65%63%6f%64%65%21
Output: UTF-8 Decode!
BUGS
Feel free to report the bug at:
http://github.com/Aitjcize/cbase/issues or
mail://aitjcize@gmail.com.
AUTHOR
Wei-Ning Huang (AZ) <aitjcize@gmail.com>
Linux MAY 2010 CBASE(1)