Skip to main content

searchf

Latest Version

Utility program to interactively search keywords in text files. Works in terminals thanks to curses.

Peek 2022-12-26 19-53

Installation

sudo apt install pipx
pipx install searchf

Requirements:

  • Python 3.9 or greater
  • Terminal with color support (ie. TERM=screen-256color or TERM=xterm-256color).

Features

  • Filters can either include or exclude file content
  • Filters can persist to disk
  • Multiple highlight and colorization modes (press h to cycle through all modes)
  • Color palettes (press c to cycle through all palettes)
  • Various other display modes (l toggles line numbers visibility, k toggles line wrapping, ...)
  • Multiple views (press 1, 2, 3 to switch) with possibility to pass filters of one view to another view (try !, @, #)
  • Common search key bindings (/, then n for next, p for previous)
  • Common key bindings to scroll up/down pages or goto line
  • Terminal resizing

Usage

searchf <FILE>

  • Press f to enter keyword in a new filter
  • Press ? for help

Press ENTER to define the first keyword of a filter and reveal only the lines containing that keyword. Press + to add another keyword to the current filter in order to further narrow down the lines currently displayed.

A filter is a list of keywords that a line must contain to match and get highlighted in a specific color. By defining multiple filters, you can reveal more content of the file. By default, lines not matching any filter are hidden, but you can progressively reveal context surrounding matching lines by pressing m multiple times, all the way to the whole content of the file. Filters can also be used to filter out content you do not want to see (press x to toggle this mode).

Screenshot 2025-04-20 at 8 13 19 AM

Why?

This tool is born from my need to interactively search into log files, with the ability to backtrack when hitting dead ends (hence the use of push/pop of filter and keyword), and to go down some exploratory paths on the side (hence the support of views). I use it most when I'm not fully aware of what I am searching for...

To be more specific, I often have to dig into build log files, which are a raw aggregate of many heterogenous sources (numerous compiler output, deployment scripts, test run and results, ...) resulting in rather unstructured output. The only commonality being that everything is more or less line-oriented. When a build failure occurs, searchf helps me find hints of the root cause which can be hiding about anywhere.

So this tool ends up making little or no assumption on the input file, which can be anything, unstructured and heterogenous, as long as it is line oriented.

Development

Please refer to DEV.md for further information.

Metadata

Release files for searchf 1.28

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for searchf 1.28
File Size Uploaded
searchf-1.28.tar.gz 49.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for searchf 1.28
File Interpreter ABI Platform
searchf-1.28-py3-none-any.whl Python 3 none any Details

Total release size: 104.2 kB

Release files / searchf-1.28.tar.gz

Download URL searchf-1.28.tar.gz
Size 49.1 kB
Tags Source
SHA-256 checksum
How to use checksums
935c392485b7a1875f278533a2a24c8c53e2d793f9bb14c396aef8fcf390b612
BLAKE2b-256 checksum
How to use checksums
fd5c711f6be6c5d2bfc66ee53232425d8e4117b0706e2830e64784ec7b817fa2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / searchf-1.28-py3-none-any.whl

Download URL searchf-1.28-py3-none-any.whl
Size 55.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
565dacaf28ae9857e6999ea4654521d3e8c042a01d103d8d7ef99e6f8ac07c42
BLAKE2b-256 checksum
How to use checksums
05d342fcb29a1e4e310c356e9157c9b7b756381e186e560e990152fd32e40195
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release history Release notifications | RSS feed

This release

1.28 This release

2 release files

1.27

2 release files

1.26

2 release files

1.25

2 release files

1.24

2 release files

1.23

2 release files

1.22

2 release files

1.21

2 release files

1.20

2 release files

1.19

2 release files

1.18

2 release files

1.17

2 release files

1.16

2 release files

1.15

2 release files

1.14

2 release files

1.13

2 release files

1.12

2 release files

1.11

2 release files

1.10

2 release files

1.9

2 release files

1.8

2 release files

1.7

2 release files

1.6.2

2 release files

1.6.1

2 release files

1.6

2 release files

1.5

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4

2 release files

1.3.1

2 release files

1.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2

2 release files

1.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page