pipr.tools
Pipes
Clean Email Strip formatting from pasted email for clean plain text Clean AI Output Clean plain text from ChatGPT or AI output Decode & Format JWT Decode a JWT and pretty-print header and payload Word Frequency Count word frequency in text

sort-lines Sort lines alphabetically

Aa Text
Input0 chars
Output0 chars

Flags

--reverse boolean default: false
--numeric boolean default: false

Examples

Sort a grocery list alphabetically

Usage
"banana
apple
cherry
date
apricot" | sort-lines

Alphabetize an employee roster

Usage
"Zhang, Wei
Smith, Alice
Patel, Raj
Garcia, Maria
Brown, Jame..." | sort-lines

Sort a list of skills for your resume

Usage
"JavaScript
Python
Rust
Go
TypeScript
Ruby" | sort-lines
View source
(input, opts = {})=>{
                const lines = input.split("\n");
                if (opts.numeric) lines.sort((a, b)=>parseFloat(a) - parseFloat(b));
                else lines.sort((a, b)=>a.localeCompare(b));
                if (opts.reverse) lines.reverse();
                return lines.join("\n");
            }