Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Select all the even columns from a file

$
0
0
Hi,

I can select all the even columns from a file like this:

Code:

awk '{ for (i=1;i<=NF;i+=2) $i="" }1' file > new file
How can I select the 1st and all the even columns using awk? Thanks!

Viewing all articles
Browse latest Browse all 16232

Trending Articles