I want to select the columns from a big file ,based on the rows from another file. This problem has been answered here but both the solutions does not work.
head0 head1 head2 head3 head4 1 25 1364 22 13 2 10 215 1 22
head0 head4 1 13 2 22
The first command of the second solution works.
cat file1.txt | cut -f$(grep -wFf file2.txt TMP | cut -f1 | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/,/g') > OUTPUT cut: option requires an argument -- f