cut

From RaySoft

cut is a command line utility on Unix and Unix-like operating systems which is used to extract sections from each line of input - usually from a file. [1]

Documentation

Further information

Syntax

cut [PARAMETER ...] [FILE ...]

Parameters

-c LIST, --characters=LIST
Select only these characters.
-d DELIMITER, --delimiter=DELIMITER
Use DELIMITER instead of TAB for field delimiter.
-f LIST, --fields=LIST
Select only these fields; also print any line that contains no delimiter character, unless the -s option is specified.
-s, --only-delimited
Do not print lines not containing delimiters.

Examples

Create a 10 bytes long random password based on the Base64 charset [a-zA-Z0-9/+]
openssl rand -rand '/dev/random' -base64 12 | cut --characters='1-10'

Output:

b5/FeVaFlWeS

References

  1. Wikipedia contributors. "cut (Unix)." Wikipedia. https://en.wikipedia.org/wiki/Cut_(Unix) (accessed 13.02.2024)