sq – squeeze a sorted word list unsq – unsqueeze a sorted word list

A UNIX Command
$cat sorted
A
B
C
D
E
F
G
$sq  result
$cat result
0A
0B
0C
0D
0E
0F
0G
$unsq  final
$cat final
A
B
C
D
E
F
G
$

UNIX Explanation
The squeezing is achieved by eliminating common prefixes,
and replacing them with  a single character which encodes
the number of characters  shared with the preceding word.
The  prefix  size  is   encoded  as  a  single  printable
character:  0-9 represent 0-9,  A-Z represent  10-35, and
a-z represent 36-61.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s