with awk
that supports regex in field separator, you can do:
awk -F'^[[:blank:]]*([^ \t]*[ \t]+){3}' '{ print $2 }' infile
cb0 cb1 cb2 cb3 ct0 ct1 ct2 ct3
replace number 3 in {3}
with number of columns you need ignore from the beginning; and space/tab with field separator which your columns delimited with other than whitespaces; so printing $2
would be the rest of columns remaining to the end; this solution will preserve multiple whitespaces between fields if any in result.
notes: to avoid printing empty line if there was a line with equal or less than 3 fields (that indicates the #
(number) of columns you need cut out) , add NF>1
to the command.
awk -F'^[[:blank:]]*([^ \t]*[ \t]+){3}' 'NF>1{ print $2 }' infile
[[:blank:]]*
is used to avoid erroneous output when FS is whitespaces; if FS is something else (e.x: comma ,
), then the command would be even simpler:
awk -F'^([^,]*,){3}' 'NF>1{ print $2 }' infile
print $i
toprintf $i" "
. Full command looks likeecho vddp vddpi vss cb0 cb1 cb2 cb3 ct0 ct1 ct2 ct3 | awk ' { for (i=3; i<=NF; i++) printf $i" " }'