webby.tools

Sort Lines

Input

Options

Sort On
Ignore Case
Strip blank lines

Results

About This Tool

This tool was built as a quick and easy way to sort lines, which is a need that comes up surprisingly often.

Options

Option Description
Sort On The method to use for sorting the lines. There are 3 options. You can sort alphabetically, on the length of the line, or using what's known as a natural sort. More on that below. And you can sort in either ascending or descending order.
Ignore Case If checked, the sorting will be case-insensitive.
Strip blank lines If checked, any lines that are empty or only contain whitespace will be removed before sorting.

Natural Sort

Normally, when a computer sorts values it sorts everything as a string. That's why you'll often end up with something like this:

1something
10something
2something
3something

That, of course, probably isn't how you want things sorted if there's numbers in the string. That's where a natural sort comes in. If we took that same list of lines and sorted them using a natural sort, we'd get this:

1something
2something
3something
10something

That's a much more natural way to sort things, and that's what the "Natural Sort" option does.

DigitalOcean Referral Badge

This website may contain affiliate links. If you click on an affiliate link and make a purchase, we may receive a small commission at no additional cost to you.