LoginSignup
8

More than 5 years have passed since last update.

posted at

updated at

seqもあるけどjotもね

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

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
8