TECHIES WORLD

For Techs.... Techniques.... Technologies....

CpanelLinux

How to print alternate columns of a file in bash

To print alternate columns of a file in bash, we can use awk utility.

#awk '{ for (i=1;i<=NF;i+=2) print $i }' file

Where file is the name of the file to be processed.

 

Leave a Reply