pn - a command-line tool for phone number manipulation
pn COMMAND [OPTIONS] INPUT
valid |
Tests whether the phone number given as INPUT is a valid number or short number. Returns 0 (SUCCESS) if the number is valid, 1 (ERROR) otherwise. Valid options: -c, -v (verbose, default off). | ||
info |
Displays informations about the phone number given as INPUT. Valid option: -c. | ||
format |
Formats a telephone number given as INPUT to the specified standard (E164 by default), result on stdout. Valid options: -c, -f. | ||
find |
Finds phone number in some text given as INPUT, result on stdout (one line per number found). Valid options: -c, -f, -l. |
dialout
Formats a phone number given as INPUT in e164 format for out-of-country dialing purposes. Valid options: -c, -l.
-c COUNTRY−CODE
If set, the phone number(s) given in INPUT will be considered as being dialed from the country specified by the 2 uppercase letters COUNTRY−CODE (e.g. "FR", "US", ...). If this option is not set, pn will look for numbers in the international format.
-f FORMAT
Sets the phone number output format. FORMAT must be one of e164, int (international), nat (national), or teluri (RFC3966 tel URI). The default value is e164.
-l LENIENCY
Sets the phone number search
leniency in INPUT. LENIENCY must be one of:
possible
Phone numbers accepted are possible, but not necessarily valid.
valid |
(default value) Phone numbers accepted are possible and valid. Numbers written in national format must have their national-prefix present if it is usually written for a number of this type. | ||
strict |
Phone numbers accepted are valid and are grouped in a possible way for this locale. For example, a US number written as "65 02 53 00 00" and "650253 0000" are not accepted at this leniency level, whereas "650 253 0000", "650 2530000" or "6502530000" are. Numbers with more than one ’/’ symbol in the national significant number are also dropped at this level. | ||
exact |
Phone numbers accepted are valid and are grouped in the same way that we would have formatted it, or as a single block. For example, a US number written as "650 2530000" is not accepted at this leniency level, whereas "650 253 0000" or "6502530000" are. Numbers with more than one ’/’ symbol are also dropped at this level. |
(see https://javadoc.io/doc/com.googlecode.libphonenumber/libphonenumber/8.4.1 for more details)
pn returns 0 on successful operations, 1 if an error occurred (option error, parsing error).
Camille Oudot <[email protected]>