This is a small JavaScript tool that aims to replicate many of the features of the command-line tools sort
and uniq
. It was developed for the simple reason that I really miss these tools whenever a command-line is not available.
- Sort items in alpha order
- Reverse sort
- Random sort
- Print unique values, i.e. with duplicates removed
- Print duplicate values
- Configurable input and output delimiters
- Works offline (just clone or download this repository and open
index.html
in any browser) - Online demo available
Enter some data in the Input box. By default the data should be separated by linebreaks (\n
), but this is configurable.
Click one of the buttons below the Input box to sort the data:
- Sort!: Sorts the data in alpha order (similar to command-line
sort
) - Uniq!: Remove duplicates and display only unique values (similar to
uniq
) - Uniq -d!: Show only duplicate values (similar to
uniq -d
) - Reverse!: Sort the data in reverse order (similar to
sort -r
) - Random!: Sort the data in random order (similar to
sort -R
)
Both input and output delimiters can be configured in the corresponding boxes at the bottom of the page.
This sets the delimiter for data entered into the Input box. The default separator is \n
(linebreaks), which means that each line will be considered a separate value. This can be changed to e.g. ,
to indicate that the values are separated by commas.
This sets the delimiter for the sorted result data. The default separator is \n
(linebreaks), which means that each value will be printed on a separate line. This can be changed to e.g. ,
to print results separated by commas.
"Sort columns" is part of the tiny tools series.
Other tools for working with columns of data that might also be of interest:
- milligram CSS by @cjpatoilo, prototyped using dropin-minimal-css
- github-corners by @tholman
MIT.