Jot Command - Generate Sequences & Data | Online Free DevTools by Hexmos

Generate sequences and data with the Jot command. Explore examples for creating random strings, ASCII characters, and more. Free online tool for developers.

Jot Command Examples

The jot command is a versatile utility for generating sequences of data, useful in scripting and command-line operations. It can produce numbers, characters, and repeating strings, making it a powerful tool for various tasks.

Generate Numerical Sequences

jot excels at creating numerical sequences. You can specify the count, start, and end values, as well as the step. For instance, to print 21 evenly spaced numbers increasing from -1 to 1:

# prints 21 evenly spaced numbers increasing from -1  to  1
jot 21 -1 1.00

Generate Character Sets

It's also capable of generating character sets. To show the ASCII character set up to 128 characters:

# Show the ASCII character set
jot -c 128 0

Create Custom String Sequences

jot can generate custom string sequences. For example, to create strings from 'xa' to 'xa' followed by 'z':

# strings xaa through xaz with
jot -w xa%c 26 a

Generate Random Strings

For random data generation, jot can be combined with other utilities. Here's how to produce 20 random 8-letter strings:

# 20 random 8-letter strings are produced with
jot -r -c 160 a z | rs -g 0 8

Infinite Repetition

The jot command can also generate an infinite sequence of a specific string, useful for creating placeholder data:

# Infinitely many yes's may be obtained through
jot -b yes 0

Advanced Sequence Generation

jot supports complex sequences, such as generating substitution commands for text processing tools like ed(1):

# thirty ed(1) substitution commands applying to lines 2, 7, 12, etc.
jot -w %ds/old/new/ 30 2 - 5

Generating Stuttering Sequences

A stuttering sequence can be produced by carefully selecting precision and step size:

# The stuttering sequence 9, 9, 8, 8, 7, etc. can be produced by suitable
# choice of precision and step size, as in
jot 0 9 -  -.5

Creating Files with Specific Sizes

jot can be used to create files of a precise size, for example, a file containing exactly 1024 bytes:

# Generate a file containing exactly 1024 bytes is created with
jot -b x 512 > block

Setting Tab Stops

In conjunction with other commands like expand, jot can help configure settings such as tab stops:

# set tabs four spaces apart starting from column 10 and
# ending in column 132
expand   -`jot -s, - 10 132 4`

Filtering Lines Based on Length

jot can assist in creating patterns for filtering commands like grep, for instance, to print all lines 80 characters or longer:

# print all lines 80 characters or longer
grep `jot -s "" -b . 80`

Explore these examples to leverage the power of the jot command in your daily development tasks.