npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

findany

v1.2.1

Published

A command line tool for search multiple substrings in a multiline text file

Readme

findany

A command-line utility that retains only those lines from a text file or standard input that contain at least one substring from a list.

Features

  • Search for multiple substrings. It is designed for efficient matching of millions of substrings.
  • Reads from standard input or a text file.
  • Writes filtered lines to standard output or redirects them to a text file.
  • Optional case-insensitive search.
  • Optional inversion of search.
  • Optionally prints only the first matched substring instead of the entire line (incompatible with inverted search).
  • Supports binary files.
  • Progress bar to show search progress when processing large files, if the output is redirected to a file.
  • Runs on Windows and Linux.

Installation

Option 1: Use npm

npm i -g findany

Option 2: Use pip

pip install findany

On Windows, make sure the /Scripts directory is added to PATH.

Option 3: Download binary

  1. Download the latest release from the Releases page.
  2. Save it to any folder (e.g. /usr/local/bin/ or C:\Users\<user>\AppData\Local\), add that folder to the PATH variable.
  3. Make executable if needed (chmod +x /usr/local/bin/findany).

Build

The program is written in C and can be compiled with gcc. It is recommended to enable SSE4.1 for low-level optimizations.

gcc -msse4.1 ./src/findany.c -o findany -O3

Test

Functional tests are configured using YAML files and run with pytest.

cd ./test && python -m pytest ./test.py

Usage

findany [OPTIONS] [SUBSTRINGS] [FILE]

Options

  • -i, --case-insensitive: Perform a case-insensitive search. By default, searches are case-sensitive.
  • -v, --invert: Search for lines that contain none of the specified substrings.
  • -o, --output OUTPUT: Redirect the output to OUTPUT instead of printing to standard output. It enables a progress-bar.
  • -s, --substring SUBSTRING: Receive a substring from a command-line argument instead of a file. It can be used multiple times. Must not be used together with the SUBSTRINGS argument.
  • -h, --help: Display the help message and exit.

Arguments

  • SUBSTRINGS: A file containing substrings to search for. Each line in this file represents a substring to search for.
  • FILE: The file to search in. If not provided, standard input will be used.

Example

  1. Search in a file for any of the substrings specified in substrings.txt and write the matching lines to output.txt:
findany -o output.txt substrings.txt input.txt
  1. Case-insensitive search for substrings:
findany -i substrings.txt input.txt
  1. Read from standard input and write to standard output:
cat input.txt | findany substrings.txt > output.txt
  1. Read from standard input, write to standard output, pass two substrings via command-line arguments:
findany -s mySubstring -s otherSubstring < input.txt > output.txt

More examples are available in the test cases folder.

License

This program is licensed under the GNU General Public License v3.0. See the LICENSE file for more details.