Cut Command in Linux – Extract Fields and Columns from a file

20335

In some of my recent articles on text processing, I have explained the use of sed command in Linux/Unix. In case of sed command, we provide an input file to the command, it reads the file line-by-line, processes each line and then prints it on the STDOUT. So, in brief, its a row-wise operation. Similar is the case with cut command – there is an input file, there is processing part and the processed output can be displayed on STDOUT or saved in a file. A minor difference between sed and cut is that, cut command processes the file in vertical manner. So, the outcome of the cut command is a single or multiple columns.

As of now, just remember that, cut command is just a filter, that processes the file and extracts columns from it. Basically, using cut command, we can process a file in order to extract – either a column of characters or some fields. Thus, to achieve more clarity about cut command, we would study it in two parts.

Read more at-  Cut Command in Linux – Extract Fields and Columns from a file