How drop specific columns¶
If you want to remove or keep specific columsn, you can cut command.
Let starts a new session and assigns it a name:
For an simple case, let use cut to just keep the columns 2 and drop the rest from the text file, you can use cut -d ' ' -f2 test.txt, here -d ' ' specifies the field delimiter\space character instead of the tab character, which heresis . In the -f flag you can specifies the specific list of columns that are separated by .
Now let revert that action and remove the second columns; use the previous command and add the --complement flag
You can use -c, to selects only the characters specified. Below cut command prints characters after 3rd.
Below cut command prints characters btween 3rd and 6th.