jotを知ったという話
- Macでseqを触っていてたら
man seq
よりjot
を知った。
環境
- Macにて
Linuxではコマンドがなさそうだ- Ubuntuの
apt-get
では、パッケージが用意されているそうです(コメントにて。あざす。)
seq
- よく使う
seq
% seq 1 5
1
2
3
4
5
jot
- BSD系で使えるようだ
% jot - 1 5
1
2
3
4
5
-
seq
より強力そうだがman
によれば
NAME
jot -- print sequential or random data
-
or randam data
ということで。
jot / or randam data
-r
DESCRIPTION
-r Generate random data instead of the default sequential data.
- とりあえずだと
- 1〜100まで、ランダムに5回抽出する
% jot -r 5 1 100
1
6
17
91
46
-w
- pritnfのように組み合わせも
-w word
Print word with the generated data appended to it. Octal, hexadecimal, exponential, ASCII, zero
padded, and right-adjusted representations are possible by using the appropriate printf(3) con-
version specification inside word, in which case the data are inserted rather than appended.
- ランダムと組み合わせてみた
% jot -w '%d Mbit/s' -r 5 1 100
38 Mbit/s
1 Mbit/s
11 Mbit/s
95 Mbit/s
21 Mbit/s
-
rs
との組みあわせでランダム文字列の生成も -
a to z
から抽出した文字を10行連結表示
% jot -r -c 50 a z | rs -g 0 10
hixwvmazju
yjoqehtkbe
iixpiseadj
skqpjjvudp
zwhmooeesl