Skip to content

18th April 2022

Computer Science

GNULinux

grep

  • New: Common options.

    • -r: recursively search a directory.
    • -i: ignore case.
    • -l: print only the path of the files that have at least one match.
  • New: Limit results line length.

    First 400 bytes of the line:

    grep "foobar" * | cut -b 1-400
    

    This might leave the match out, but it's simple to use and enough for most cases. The other option is:

    grep -rEo ".{0,10}wantedText.{0,10}" *
    

neovim

  • New: Marks.

    A mark allows you to record your current position so you can return to it later.

    Usage:

    • :marks: show existing marks.
    • ma: set mark a in current position of current file, accessible only from the current file.
    • mA: set mark A in current position of current file, accessible from anywhere.
    • 'a: Go to mark a.
    • ]': jump to next line with a lowercase mark.