Line numbers
Add line numbers to text with your choice of start, padding and separator, or strip them off again.
Input
Result
Fill in the input and press Run.
Your input is processed in memory and then discarded. It is not stored or logged. Even so, don't paste live passwords or keys into any online tool.
Use it from code or an agent
curl -s https://setget.net/v1/tools/line-numbers \
-H 'Content-Type: application/json' \
-d '{"input":{"text":"alpha\nbeta\ngamma"}}'
import json, urllib.request
body = {'input': {'text': 'alpha\nbeta\ngamma'}}
request = urllib.request.Request("https://setget.net/v1/tools/line-numbers", json.dumps(body).encode(),
{"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/line-numbers", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({"input":{"text":"alpha\nbeta\ngamma"}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
"slug": "line-numbers",
"input": {
"text": "alpha\nbeta\ngamma"
}
}
{
"input": {
"text": "alpha\nbeta\ngamma"
}
}
Endpoint: POST /v1/tools/line-numbers. Over MCP: run_tool with slug: "line-numbers".
Machine-readable: input schema, Markdown. Connect an agent.
Inputs
| Name | Type | Required | What it does |
|---|---|---|---|
text |
string | yes | The text to number, or numbered text to clean. |
action |
string | no | Add numbers or remove existing ones. One of: add, remove. Default: "add". |
start |
integer | no | Number given to the first line. Default: 1. From 0 to 1000000000. |
padding |
string | no | Make all numbers the same width with leading spaces or zeros. One of: none, space, zero. Default: "none". |
separator |
string | no | Text placed between the number and the line. Used when adding. Default: ": ". |
skip_blank |
boolean | no | Leave blank lines without a number. Default: false. |
Examples
Input
{
"text": "alpha\nbeta\ngamma"
}Result
{
"text": "1: alpha\n2: beta\n3: gamma",
"lines": 3
}Zero-padded
Input
{
"text": "a\nb",
"start": 9,
"padding": "zero",
"separator": " | "
}Result
{
"text": "09 | a\n10 | b",
"lines": 2
}Removing numbers
Input
{
"text": "1. alpha\n2. beta",
"action": "remove"
}Result
{
"text": "alpha\nbeta",
"lines": 2
}Questions
- Which number formats does "remove" understand?
- A number at the start of the line, with optional spaces before it, followed by a space, a tab or one of . : ) ] | > -
- Will "remove" delete numbers that belong to the text?
- Yes, if a line starts with one. "2024 was a good year" loses its "2024". Check the result when lines can start with real numbers.
Related tools
- Sort linesSort lines alphabetically, naturally (file2 before file10), by number or by length, or reverse their order.
sort-lines - Wrap and indent textHard-wrap text to a line width, add or remove indentation, and put a prefix such as "> " on every line.
wrap-indent - Markdown to plain textRemove Markdown formatting and keep the readable text: headings, emphasis, links, images, lists and code.
strip-markdown - Apply a patchApply a unified diff to a text and get the patched result, with clear errors when a hunk does not fit.
patch-apply - Case converterConvert text between lower, UPPER, Title, Sentence, camelCase, PascalCase, snake_case, kebab-case and more.
case-convert - Escape and unescape textEscape or unescape text for HTML, URLs, JSON strings, shell commands, regular expressions and CSV fields.
escape-unescape