I am facing an error in cut
command and tried to find a solution but were not helpful. I have a tab-delimited file that I pipe to replace the tabs with comma. Then I pipe to get rid of specific columns using cut --complement
but I get this error:
cut: [-cf] list: illegal list value
My command:
cat input.txt | grep -v '#' | tr '\t' ',' | cut -d ',' -f2,3,4,5,6 --complement | head
When I remove the --complement
it prints the columns 2,3,4,5,6
but with the --complement
it does not work.
Any help will be appreciated.
BSD cut doesn't have a --complement
option. In this specific case, you can use:
cut -d , -f 1,7-
instead of
cut -d ',' -f2,3,4,5,6 --complement