Command line
bash
npx line-seeker <file> [options]Use - as <file> to read stdin (stream only; no index).
--line <n> print one line (negative = from EOF)
--locate <n> print JSON { line, lineNumber, offset, nextOffset }
--around <n> print a window around a line
--before <n> lines before a --grep / --around hit
--after <n> lines after a --grep / --around hit
--range <a>-<b> print an inclusive range
--copy <a>-<b> stream a range to stdout (no maxRange cap)
--tail <n> print the last n lines
--lines <n,n,n> print scattered lines
--grep <pattern> search (string or /regex/flags)
--matches <pattern> print the hit count for a pattern
--limit <n> max matches for --grep
--start <n> start line for --grep
--end <n> end line for --grep
--set <n> replace line n (needs --with)
--insert <n> insert before line n (needs --with)
--delete <a>[-<b>] delete a line or inclusive range
--with <text> payload for --set / --insert
--count print the line count
--index build a sidecar index
--refresh extend an existing index after append
--stride <n> index density (default 64)
--follow print new lines as they arrive
--from-start with --follow, replay the file first
--poll <ms> follow poll interval (default 250)
--no-watch follow: poll only, do not fs.watch
--encoding <enc> line decoding (default utf8)
--index-path <path> sidecar index location
--cache-index store the index under the cache dir
--cache-dir <path> override cache directoryExamples
bash
npx line-seeker app.log --line 50
npx line-seeker app.log --locate 35495596
npx line-seeker app.log --around 35495596 --before 5 --after 5
npx line-seeker app.log --copy 1000000-1000200 > slice.log
npx line-seeker app.log --matches ERROR
npx line-seeker app.log --line -1
npx line-seeker app.log --range 100-105
npx line-seeker app.log --range -50--1
npx line-seeker app.log --tail 100
npx line-seeker app.log --lines 3,80,500000
npx line-seeker app.log --grep ERROR --limit 20
npx line-seeker app.log --grep '/ERROR|FATAL/i' --start 1 --end 10000
npx line-seeker app.log --count
npx line-seeker app.log --index --stride 64
npx line-seeker app.log --refresh
npx line-seeker notes.txt --set 3 --with "updated"
npx line-seeker notes.txt --insert 1 --with "# header"
npx line-seeker notes.txt --delete 2-4
cat app.log | npx line-seeker - --grep ERROR--count prints a bare decimal. No color, so scripts can read it. Without an index this scans the file.
--grep writes one diagnostic line per hit. Exit code 1 if nothing matched. It is a JavaScript scan of decoded lines, not ripgrep.
--index prints the JSON build result (lineCount, entryCount, stride, …). That command reads the whole file once.
--set / --insert / --delete copy the file through a temp path. Cost follows file size, not the edited line.
A missing file is a single line on stderr, exit code 1, no Node stack.