MATCH(1L)

πŸ“¦ version 1.6, in nixos 26.05, nixpkgs unstable

πŸ’– NAME πŸ’–

okay bestie, this page is for match from SchilyΒ΄s USER COMMANDS β€” yes, that’s MATCH(1L) in the house πŸ’… β€” and it searches for patterns in files. lowkey iconic.

✨ SYNOPSIS ✨

match [ -option ] pattern [ file ...  ]

πŸ’– DESCRIPTION πŸ’–

So match searches the named files β€” or standard input if you don’t give any filenames β€” for occurrences of the given pattern on each line. It accepts literal characters or special pattern matching characters. Every line that matches the pattern gets output on standard output. ✨

You can only specify one pattern string for each match, but bestie, you can construct an arbitrarily complex string. When you do not specify a file, match can be used as a filter to display desired lines. Standard in is used if no files are specified. fr fr.

πŸ’… OPTIONS πŸ’…

  • -not, -v β€” prints all lines that do not match.
  • -i β€” ignore the case of letters.
  • -m β€” force not to use the magic mode.
  • -w β€” search for the pattern as a word.
  • -x β€” display only those lines which match exactly.
  • -c β€” display matching count for each file.
  • -l β€” display name of each file which matches.
  • -s β€” be silent, and indicate a match in the exit code.
  • -h β€” do not display filenames.
  • -n β€” precede matching lines with line number (with respect to the input file).
  • -b β€” precede matching lines with block number.

πŸ¦‹ REGULAR EXPRESSIONS πŸ¦‹

Here’s the full list of all the pattern matching characters, bestie β€” no skips, no crumbs:

  • c β€” an ordinary character (not one of the special characters discussed below) is a one character regular expression that matches that character.
  • \c β€” a backslash (\) followed by any special character is a one character regular expression that matches the special character itself. The special characters are: ! # % * { } [ ] \ ? ^ $
  • ! β€” logical OR, as in match this!that!the_other. You may have to use {} for precedence grouping.
  • # β€” a hash mark followed by any regular expression matches any number (including zero) occurrences of the regular expression.
  • ? β€” matches exactly any one character. W? matches Wa, Wb, Wc, W1, W2, W3 ...
  • * β€” matches any number of any character.
  • % β€” matches exactly nothing. It can be used in groups of ored patterns to specify that an empty alternative is possible.
  • {} β€” curly brackets may be used to enclose patterns to specify a precedence grouping, and may be nested. {%!{test}}version matches the strings testversion and version.
  • [string] β€” a non empty string of characters enclosed in square brackets is a one character regular expression that matches any one character in that string. If however the first character of the string is a circumflex (^), the one character expression matches any character which is not in the string. The ^ has this special meaning only if it occurs first in the string. The minus (-) may be used to indicate a range of consecutive ASCII characters; for example, [0-9] is equivalent to any one of the digits. The - loses it’s special meaning if it occurs first (after an initial ^, if any) or last in the string. The right square bracket (]) and the backslash (\) must be quoted with a backslash if you want to use it within the string.
  • ^ β€” matches the beginning of a line.
  • $ β€” matches the end of a line. (^*$ matches any entire line)

πŸŽ€ EXAMPLES πŸŽ€

No examples are listed in the original page. it’s giving mysterious. 🫢

πŸ“ FILES πŸ“

None.

🌈 SEE ALSO 🌈

πŸ’€ DIAGNOSTICS πŸ’€

No diagnostics are listed in the original page.

🧚 NOTES 🧚

Even if a match occurs more than once per line, the line is output only once. periodt.

Quote special pattern matching characters to prevent them from being expanded by the Command Interpreter.

πŸ™ˆ BUGS πŸ™ˆ

The length of the pattern is currently limited to 100 characters. 😭

This limit is reduced by 38 if the -w option is used.


okay that’s the whole vibe β€” this page is MATCH(1L) from SchilyΒ΄s USER COMMANDS, written by Joerg Schilling, dated 15. Juli 1988. bye bestie! πŸ’–

πŸ“¦ where this page comes from