Complement Output (--complement) Using cut Command
–complement: As the name suggests it complement the output. This option can be used in the combination with other options either with -f or with -c.
cut --complement -d " " -f 1 state.txt
cut --complement -c 5 state.txt
cut command in Linux with examples
The cut command in linux is a command for cutting out the sections from each line of files and writing the result to standard output. It can be used to cut parts of a line by byte position, character, and field. The cut command slices a line and extracts the text. It is necessary to specify an option with a command otherwise it gives an error. If more than one file name is provided then data from each file is not preceded by its file name.
Table of Content
- Syntax of cut Command
- Options Available in cut Command
- Practical Examples of cut Command
- Extract Specific Bytes (-b) Using cut Command
- Cut by Character (-c) Using cut Command
- Cut by Field (-f) Using cut Command
- Complement Output (–complement) Using cut Command
- Output Delimiter (–output-delimiter) Using cut Command
- Display Version (–version) Using cut Command
- How to use tail with pipes(|) in cut Command
- Frequently Asked Questions on cut Command in Linux – FAQs