# Sort and dedupe lines

> Sort a list alphabetically, by length or in reverse, remove duplicate and empty lines, and trim spaces. Free online list cleaner, nothing stored.

Free tool by Orkosi. Page: https://orkosi.com/tools/line-sorter

Clean up an email list, a set of keywords or a column pasted from a spreadsheet: sort it, drop the repeats and the blank lines, and copy it back.

1. Paste one item per line.
2. Choose the order and what to remove.
3. Press Convert and copy the cleaned list.

## Input

| Field | Type | Required | What it is |
| --- | --- | --- | --- |
| `text` | text | yes | Lines. |
| `order` | "asc" \| "desc" \| "length" \| "reverse" \| "none" | no | Order. Default: "asc". |
| `dedupe` | true \| false | no | Remove duplicates. Default: true. |
| `trim` | true \| false | no | Trim spaces. Default: true. |
| `remove_empty` | true \| false | no | Remove empty lines. Default: true. |
| `case_sensitive` | true \| false | no | Case sensitive. Default: false. |

## Example

Input:

```json
{
  "text": "pear\napple\n\nBanana\napple\nitem 10\nitem 2\n  pear  "
}
```

Result:

```json
{
  "output": "apple\nBanana\nitem 2\nitem 10\npear",
  "lines_in": 8,
  "lines_out": 5,
  "removed": 3
}
```

## Run it

It needs a free Orkosi account, nothing else. No credits are used.

- **A person**: open the page, enter an e-mail once, use the tool.
- **Claude or ChatGPT**: add the Orkosi connector `https://orkosi.com/api/v1/public/mcp` and sign in, or create the free account on the sign-in page. Then call `orkosi_run_free_tool` with `{ "tool": "line-sorter", "input": { … } }`.
- **Any agent or program that can make an HTTP request**:

  1. Once, create the account: `POST https://orkosi.com/api/v1/public/signup` with `{ "name": "…", "email": "…", "terms_accepted": true }` and no key. Ask the person for the e-mail and their agreement to the terms first. The answer carries `data.api_key`, shown once.
  2. Run the tool:

```bash
curl -X POST https://orkosi.com/api/v1/public/tools/line-sorter/run \
  -H "Authorization: Bearer $ORKOSI_API_KEY" -H "Content-Type: application/json" \
  -d '{"input":{"text":"pear\napple\n\nBanana\napple\nitem 10\nitem 2\n  pear  "}}'
```

The answer is `{ "data": { "tool": "…", "result": { … } } }`. A call without a key is answered 401 with the signup steps as data.

## Questions

**Are numbers sorted correctly?**

Yes. Sorting is natural: item 2 comes before item 10, not after it.

**Is "Apple" the same as "apple"?**

By default yes, so one of them is removed as a duplicate. Turn on Case sensitive to keep both.

**Can I remove duplicates without sorting?**

Yes. Choose Keep order and only the duplicates and empty lines are removed.

All free tools: https://orkosi.com/tools.md
