head Keep first N lines
Flags
--lines number default: 10
Examples
Preview the first 10 lines of an access log
Usage
"200 /api/users 12ms
404 /old-dashboard 3ms
200 /api/auth 45m..." | head Preview the first few rows of a customer CSV export
Usage
"Name,Email,Plan,MRR
Alice,[email protected],Pro,$99
Bob,[email protected],..." | head Show only the weekday entries from a schedule
Usage
"Monday: Team standup
Tuesday: Client call
Wednesday: Sprint ..." | head --lines=5 View source
(input, opts = {})=>{
const n = parseInt(opts.lines) || 10;
return input.split("\n").slice(0, n).join("\n");
}