Showing posts with label 奇数. Show all posts
Showing posts with label 奇数. Show all posts

Saturday, September 10, 2016

seq & AWK: Generating Sequence of Even and Odd Number Between 1 and 10

Command (even):

$ seq 1 10 | awk '$1%2==1 {print $1}'


Result:

1
3
5
7
9


Command (odd):

$ seq 1 10 | awk '$1%2==0 {print $1}'


Result:

2
4
6
8
10