cut's Examples

fetch string of characters by their byte count

$ echo "hello world" | -b 1,2,4,6,8

extract the strings from the specified file

cut -b 1,2,3,4 number.txt

extract the characters as per their positions

$echo "hello world" | cut -c 1,2,4,6,7

cut and print multiple range of byte in the given file

$ cut -b 1-3 numbers.txt

cut and print multiple range of byte in the given file

$ cut -b 1-3 numbers.txt

fetch number of characters in the given file

$ cut -c 4-7 numbers.txt

fetches the characters from the given 3rd line

$ cut -c3 numbers.txt

fetches particular lines in the given file

$ cut -f 1,2 yesh.txt

fetches particular lines in the given file

$ cut -f 1,2 yesh.txt

generates ana output with the space dilimeter

$ echo "hello word" | cut -d ""-f 1 -s

the delimeter value of the given string

$ echo " the one of world " | cut -d " " -f 3,4

fetch the stings from the file

$ cut -c 3,4,5,6. numbers.txt

DevOpsSchool
Typically replies within an hour

DevOpsSchool
Hi there 👋

How can I help you?
×
Chat with Us