CSEARCH(1)

πŸ’– CSEARCH(1) πŸ’–

okay bestie, welcome to the csearch manual page, brought to you by the General Commands Manual, no cap ✨


🌸 NAME 🌸

csearch β€” it's giving grep(1), but make it over all your indexed files πŸ’…


✨ SYNOPSIS ✨

csearch [-c] [-f fileregexp] [-h] [-i] [-l] [-n] regexp

πŸ¦‹ DESCRIPTION πŸ¦‹

So basically csearch acts like grep, except it runs over every single file that's been indexed, and it's hunting for regexp, which is an RE2 regular expression (that's like nearly PCRE, if you know, you know 🧚).

The -c, -h, -i, -l, and -n flags work exactly like they do in grep β€” BUT, and this is important bestie, because of Go's flag parsing convention they cannot be combined. Like, the option pair -i -n absolutely cannot be abbreviated to -in. Not a vibe, it's just how it is πŸ™ˆ.

The -f flag keeps the search restricted to files whose names match the RE2 regular expression fileregexp.

Now the real tea: csearch depends entirely on there being an up-to-date index that was created ahead of time. It's not out here indexing on the fly, it's too main character for that πŸ‘‘. To build or rebuild the index that csearch uses, run:

cindex path...

where path... is a list of directories or individual files you want included in the index. If there's no index yet, this command creates one. If an index already exists, cindex just overwrites it. Peep cindex(1) for more details πŸŽ€.


πŸ’… OPTIONS πŸ’…

  • -c β€” suppresses the normal output; instead it prints a count of matching lines for each input file.
  • -f fileregexp β€” restricts the search to files whose names match the RE2 regular expression fileregexp.
  • -h β€” suppresses the prefixing of file names on output.
  • -i β€” ignores case distinctions in both the regexp and the input files.
  • -l β€” suppresses the normal output; instead it prints the name of each input file from which output would normally have been printed.
  • -n β€” prefixes each line of output with the 1-based line number within its input file.

🌈 ENVIRONMENT 🌈

csearch uses the index stored in $CSEARCHINDEX or, if that variable is unset or empty, $HOME/.csearchindex. So like, if you're wondering where your index lives, that's the address bestie 🏠✨


πŸ’œ SEE ALSO πŸ’œ

cindex(1), cgrep(1), grep(1).


πŸŽ€ AUTHOR πŸŽ€

This manual page was written by Michael Stapelberg <stapelberg@debian.org>, for the Debian project (and may be used by others). iconic behavior fr fr 🫢


and that's the whole page, periodt πŸ’– this little manual page has been serving since 2013-06-23 β€” go off, queen, we're obsessed πŸŒΈπŸ’…βœ¨