Copied to clipboard

cut

`cut` command line can extract specified columns from text files, or cut specified parts of files and output the results to standard output.
For example: the 3rd character: '3'; the first 10 characters: '1-10'

Examples

  • Display the first 10 characters of a file: cut -c 1-10 file.txt
  • Display the third character of a file: cut -c 3 file.txt
  • Use comma as delimiter, display the second and fourth columns of a file: cut -d ',' -f 2,4 file.txt
  • Display all columns except the first and third columns of a file: cut -f 1,3 --complement file.txt