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

count Count occurrences of each unique line

Aa Text
Input0 chars
Output0 chars

Examples

Count occurrences of each log level

Usage
"error
info
error
warn
info
error
info
info" | count

Tally survey responses by answer choice

Usage
"Yes
No
Yes
Maybe
Yes
No
Yes
Maybe
No" | count

Count occurrences of each traffic source or UTM value

Usage
"google
facebook
google
email
google
facebook
direct
email" | count
View source
(input)=>{
                const freq = {};
                for (const line of input.split("\n"))freq[line] = (freq[line] || 0) + 1;
                return Object.entries(freq).sort((a, b)=>b[1] - a[1]).map(([val, n])=>`${n}\t${val}`).join("\n");
            }

Also useful for