I have a space delimited input text file. I would like to delete columns where the column header is size using sed or awk.
Input File:
id quantity colour
awk commandawk '
NR==1{
for(i=1;i<=NF;i++)
if($i!="size")
cols[i]
}
{
for(i=1;i<=NF;i++)
if(i in cols)
printf "%s ",$i
printf "\n"
}' input > output
column -t -s ' ' output
id quantity colour shape colour shape colour shape
1 10 blue square red triangle pink circle
2 12 yellow pentagon orange rectangle purple oval