Cliamp
C

Cliamp

Cliamp

CLI
2,627 stars
N/A forks
N/A contributors

README

Project documentation from GitHub

Cliamp: A CLI Tool That Clamps Your Outputs, But Not Like You Think

You know that moment when you're piping a command and the output is either too much, too little, or just... noisy? Cliamp is a tiny CLI utility that solves a weirdly specific problem: it clamps the number of lines or characters in your output. Think of it as head and tail had a baby, but with a smarter, more flexible approach.

It's one of those tools you didn't know you needed until you're debugging a 10,000-line JSON dump and just want to see the first 20 lines and the last 10. Or maybe you're running a script that spits out a wall of logs and you need the middle chunk. Cliamp does that.

What It Does

Cliamp reads from stdin (or a file) and lets you specify a range of lines or characters to output. You give it a clamp—like 1..20 or 10..-5—and it spits out only that slice. Simple, clean, no fluff.

Here's the core idea:

  • Line clamping: cat bigfile.log | cliamp 10..20 prints lines 10 through 20.
  • Character clamping: cliamp --char 100..200 gives you characters 100 to 200.
  • Smart ranges: Use negative indices like -20..-1 to get the last 20 lines. Or ..50 for the first 50. Or 10.. for everything after line 10.

It's that straightforward. No learning curve, no config files.

Why It's Cool

  1. Zero dependencies. It's a single Rust binary. You can drop it in your PATH and forget about it.
  2. Negative indexing. This is the killer feature. head -n 20 gives you the first 20 lines. tail -n 20 gives you the last 20. But what if you want lines 10 through 20? Or lines 10 through the end? Cliamp does all of that with one command. No piping head into tail into awk.
  3. Character mode. Ever tried to preview a binary file or a huge single-line JSON? head is useless. Cliamp's --char flag lets you grab a chunk of characters directly. Perfect for inspecting blobs or debugging serialized data.
  4. Error‑friendly. If you ask for a range that's out of bounds, Cliamp doesn't crash—it just outputs what it

Did you like this issue?

Join our weekly newsletter

Related Projects

Love discovering amazing projects?

Help us continue bringing you the best open-source discoveries every week.

Back to Projects
Last updated: May 30, 2026