Unix

CUT command in Unix/Linux with examples

Cut Command:

– CUT is used to process data in file.
– Works only on file having column formatted data
Command 1: Display particular position character
cut -c3 file.txt

Command 2: Range of characters
cut -c3-8 file.txt
cut -c3- file.txt
cut -c-10 file.txt

Command 3: Display Columns after seperation
cut -d “|” -f2 file.txt
cut -d “|” -f2-3 file.txt
cut -d “|” -f2- file.txt

Command 4: Display all other than given columns[–complement]
cut -d “|” -f2 file.txt
cut -d “|” –complement -f2 file.txt

Share This Post

Avatar
An Ambivert, music lover, enthusiast, artist, designer, coder, gamer, content writer. He is Professional Software Developer with hands-on experience in Spark, Kafka, Scala, Python, Hadoop, Hive, Sqoop, Pig, php, html,css. Know more about him at www.saikumar.me

Lost Password

Register