Monday, December 31, 2007
jot - print sequential or random data
Debian Users: get "jot" as a part of "athena-jot" package.
$ sudo apt-get install athena-jot
General Use:
General uses are a bit like "seq" as I discussed in one of my post.
#Print from 1-3
$ jot 3
1
2
3
#Print from 12 to 14 (3 numbers)
$ jot 3 12
12
13
14
#Divide the boundary from 12 to 16(both inclusive) into 3 equal lengths
$ jot 3 12 16
12
14
16
#Same as above, with decimal point mentioned.
$ jot 4 12 17.0
12.0
13.7
15.3
17.0
#(-p) option for mentioning the precision
$ jot -p4 4 12 17.0
12.0000
13.6667
15.3333
17.0000
#Passing 4th Arg, the difference(interval)
$ jot 4 23 26.0 .5
23.0
23.5
24.0
24.5
$ seq 23 .5 26
23
23.5
24
24.5
25
25.5
26
# Printing from 23 to 26 with diff 1, omitting number of values(first field)
$ jot - 23 26 1
23
24
25
26
#If not omitted, the above statement
$ jot 2 23 26 1
23
24
Some Options:
(-r) To create 5 six digits random numbers: (Between 100000 and 999999)
$ jot -r 5 100000 999999
343569
181168
312641
674727
892528
(-b) Repeat a given word(digit)
$ jot -b unstable 3
unstable
unstable
unstable
(-c) Character for ASCII 67
$ jot -c 1 67
C
The other way around (ASCII to Decimal)
$ jot 1 C
67
Printing all the alphabets:
$ jot -c 26 A | tr '\n' ' '
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Subscribe to:
Post Comments (Atom)
© Jadu Saikia www.UNIXCL.com
4 comments:
or we can use jot's -s <delim>, instead of tr:
jot -s " " -c 26 A
jot is also useful to display strings, given some character(s) and length:
jot -s "" -b "-" 40
-Alex
http://bsd.org.mx/
@Alex, nice tips. Thanks, really useful.
jot -c 26 A | xargs
xargs is also a good idea
Bash brace expansion:
$ echo {a..z}
a b c d e f g h i j k l m n o p q r s t u v w x y z
$ echo {A..Z}
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
$ echo {1..9}
1 2 3 4 5 6 7 8 9
Post a Comment