What does the -c option do in the 'cut' command?

0252

The -c option in the cut command is used to specify the character positions to extract from each line of input. You can provide a single character position, a range of positions, or a combination of both.

Example Usage:

To extract specific characters from a file, you can use:

cut -c 1-5 filename.txt

This command will output the first five characters of each line in filename.txt.

You can also specify non-contiguous character positions:

cut -c 1,3,5 filename.txt

This will output the 1st, 3rd, and 5th characters from each line in filename.txt.

0 Comments

no data
Be the first to share your comment!