27.6. Numeric

简介:

27.6.1. 数值运算

echo $((3+5))
expr 6 + 3
awk 'BEGIN{a=(3+2)*2;print a}'
		

27.6.2. seq - print a sequence of numbers

[neo@test ~]$ seq 10
1
2
3
4
5
6
7
8
9
10
[neo@test ~]$ seq 5 10
5
6
7
8
9
10

		

等差列, 步长设置

$ seq 1 1 10
1
2
3
4
5
6
7
8
9
10

$ seq 1 2 10
1
3
5
7
9

# seq 0 2 10
0
2
4
6
8
10
		

分隔符

# seq -s : -w 1 10
01:02:03:04:05:06:07:08:09:10

# seq -s '|' -w 1 10
01|02|03|04|05|06|07|08|09|10
		

等宽,前导字符用0填充

# seq -w 1 10
01
02
03
04
05
06
07
08
09
10
		

27.6.3. bc - An arbitrary precision calculator language

$ echo "4*5" | bc
		
# more calc.txt
3+2
4+5
8*2
10/4
# bc calc.txt
5
9
16
2




原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

目录
相关文章
|
4月前
|
算法 NoSQL BI
variable precision SWAR算法
variable precision SWAR算法
完美解决Non-terminating decimal expansion; no exact representable decimal result.异常
完美解决Non-terminating decimal expansion; no exact representable decimal result.异常
22012 0
完美解决Non-terminating decimal expansion; no exact representable decimal result.异常
|
5月前
std::numeric_limits
std::numeric_limits
36 0
|
存储 SQL 数据库管理
NUMERIC(10,4) 和DECIMAL(10, 4) 的区别和用法?
NUMERIC(10,4) 和DECIMAL(10, 4) 的区别和用法
521 0
|
关系型数据库
PG:INT4 VS. FLOAT4 VS. NUMERIC
PG:INT4 VS. FLOAT4 VS. NUMERIC
130 0
pd.to_numeric
作用:将参数转换为数字类型。
138 0
|
算法
variable-precision SWAR算法介绍
variable-precision SWAR算法介绍
260 0
|
数据库
Data truncation: Out of range value for column ‘estimate_score‘
Data truncation: Out of range value for column ‘estimate_score‘
|
API
can't convert BigInt value to Number value
can't convert BigInt value to Number value
198 0