Search snippets
Browse Code Answers
FAQ
Usage docs
Log In
Sign Up
Home
Shell/Bash
linux command print only odd columns
Yadav Yadav
Programming language:
Shell/Bash
2021-07-06 18:31:43
0
Q:
linux command print only odd columns
ljacqu
Code:
Shell/Bash
2021-03-06 23:25:18
awk
'{for(x=
1
;x<=NF;x++)if(x %
2
)printf
"%s"
, $x (x == NF || x == (NF-
1
)?
"\n"
:
" "
)}' ahj.txt
0
Tags
int
linux
command
columns
print
Related
only show first lines linux
print first lines of file linux
Write a shell script to find the sum of first ‘N’ numbers in Fibonacci series
delete first two lines of file linux
New to Communities?
Join the community