Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
586 views
in Technique[技术] by (71.8m points)

awk - Gnuplot second from right or last coulmn


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

No need for awk. If you do stats you could limit it to one row with every ::0::0. It should be pretty fast. Try the following complete example:

Code:

### plotting columns from right
reset session

$Data <<EOD
11  21  31  41  51  61  71
12  22  32  42  52  62  72
13  23  33  43  53  63  73
14  24  34  44  54  64  74
15  25  35  45  55  65  75
16  26  36  46  56  66  76
17  27  37  47  57  67  77

EOD

stats $Data u 0 every ::0::0 nooutput
ColMax = STATS_columns

ColFromRight(col) = column(ColMax-col+1)

plot $Data u (ColFromRight(3)):(ColFromRight(4)) w lp pt 7
### end of code

Result:

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...