Как делают я ищу'!' (восклицательный знак) в странице руководства?

Я хочу получить объяснение ! опция (что означает, исключают) в find команда в man find.

И затем я нажимаю / и shift + 1 , a Non-match высунутый, вместо ! Таким образом, мой вопрос состоит в том, как искать ! в странице справочника?

image

13
задан 12 March 2017 в 00:44

3 ответа

Значение по умолчанию man пейджер less. Если Вы смотрите на lessсправка (нажатие h в то время как в нем), Вы будете видеть:

                          SEARCHING

  /pattern          *  Search forward for (N-th) matching line.
  ?pattern          *  Search backward for (N-th) matching line.
  n                 *  Repeat previous search (for N-th occurrence).
  N                 *  Repeat previous search in reverse direction.
  ESC-n             *  Repeat previous search, spanning files.
  ESC-N             *  Repeat previous search, reverse dir. & spanning files.
  ESC-u                Undo (toggle) search highlighting.
  &pattern          *  Display only matching lines
        ---------------------------------------------------
        A search pattern may be preceded by one or more of:
        ^N or !  Search for NON-matching lines.

Или в man less:

/pattern
      Search forward in the file for the N-th line containing the pat‐
      tern.  N defaults to 1.  The pattern is a regular expression, as
      recognized  by  the  regular expression library supplied by your
      system.  The search starts at the first line displayed (but  see
      the -a and -j options, which change this).

      Certain  characters  are  special if entered at the beginning of
      the pattern; they modify the type of search rather  than  become
      part of the pattern:

      ^N or !
             Search for lines which do NOT match the pattern.

Так, шаблон просто ! пустой шаблон (который соответствует чему-либо), отрицаемый - таким образом, ничто не будет соответствовать ему.

Необходимо будет выйти из значения ! в начале шаблона, любым использованием обратной косой черты (\!), или иначе делая его не первым символом regex (/[!], например).

Другой путь состоит в том, чтобы использовать grep:

$ man find | grep !
       with  `-', or the argument `(' or `!'.  That argument and any following
       ! expr True  if  expr  is false.  This character will also usually need
              Same as ! expr, but not POSIX compliant.
       The POSIX standard specifies parentheses `(', `)', negation `!' and the
       find /sbin /usr/sbin -executable \! -readable -print
       find . -perm -444 -perm /222 ! -perm /111
       find . -perm -a+r -perm /a+w ! -perm /a+x
       -perm  /222 or -perm /a+w) but are not executable for anybody ( ! -perm
       /111 and ! -perm /a+x respectively).
       find . -name .snapshot -prune -o \( \! -name *~ -print0 \)|
17
ответ дан 23 November 2019 в 03:13

Вам нужен к типу \ перед Вами тип !, так, чтобы он не был интерпретирован как регулярное выражение отрицания в поиске.

9
ответ дан 23 November 2019 в 03:13

Другой способ сделать это:

man --html=firefox find

После того, как страница справочника открывается в Firefox, нажмите CTRL + F для поиска любого символа.

4
ответ дан 23 November 2019 в 03:13

Другие вопросы по тегам:

Похожие вопросы: