Hi,
I have a file as follows:
2|
10|
11|
12|
13|
14|
15|
16d|
2|
3|
31d||
4|
5|
6|
60d|
7|
8|
9|
if I run:
awk 'BEGIN{FS=OFS="|"}{if ($1>a ) {print $1 }; a=$1}' ss
I get
2
10
11
12
13
14
15
16d
2
3
So it means 2>16d>15>,,,>10>2.
and if I run
awk 'BEGIN{FS=OFS="|"}{if ($1>=1 && $1<=5 ) { $1 = "pp" } else if ($1>=6 && $1<=10 ) {$1 = "ss"} print $1}' ss
I got
pp
ss
11
12
13
14
15
pp
pp
pp
pp
pp
pp
ss
60d
ss
ss
ss
It means awk treats 15d as between 1 and 5, 31d between 1 and 5, but does not treat 60d between 6 and 16.
Could someone explain this?
Shaoji
I have a file as follows:
2|
10|
11|
12|
13|
14|
15|
16d|
2|
3|
31d||
4|
5|
6|
60d|
7|
8|
9|
if I run:
awk 'BEGIN{FS=OFS="|"}{if ($1>a ) {print $1 }; a=$1}' ss
I get
2
10
11
12
13
14
15
16d
2
3
So it means 2>16d>15>,,,>10>2.
and if I run
awk 'BEGIN{FS=OFS="|"}{if ($1>=1 && $1<=5 ) { $1 = "pp" } else if ($1>=6 && $1<=10 ) {$1 = "ss"} print $1}' ss
I got
pp
ss
11
12
13
14
15
pp
pp
pp
pp
pp
pp
ss
60d
ss
ss
ss
It means awk treats 15d as between 1 and 5, 31d between 1 and 5, but does not treat 60d between 6 and 16.
Could someone explain this?
Shaoji