I have this table below that has multiple columns. What I want is to print first and the second column only
this command below produces the below table:
kubectl get ing -n my-namespace
firstcolumn secondcolumn third columns
1 test value
3 test2 value
2 test3 value
5 test4 value
6 test value
expected output should be:
firstcolumn secondcolumn
1 test
3 test2
2 test3
5 test4
6 test
this below command only awk the first column.
kubectl get ing -n my-namespace | awk '{ printf "%10s\n", $2 }'
how to awk both first and second columns?
third columnswith a space, can it occur on other columns too?awk '{ printf "%10s\n", $2 }'does not print the 1st column, it prints the 2nd column (note the$2as opposed to$1). Given that$2means the2nd column, is it obvious now how to print the1st column too? If not - is that white space between your columns a single tab char or multiple blank chars or something else?