The cut command specifies which characters to extract from a file using the -c option followed by the character positions you want to extract.
Here’s the syntax:
cut -c <character-list> <filename>
<character-list>can be a single character position (e.g.,1), a range of positions (e.g.,1-5), or a combination of both (e.g.,1-5,7,9).<filename>is the name of the file you want to process.
Example
To extract the first 5 characters from a file named example.txt, you would use:
cut -c 1-5 example.txt
This command will output the first five characters of each line in example.txt.
