Skip to main content

How to indicate start of line in less search of man pages?

added 4 characters in body; edited tags
Source Link
ilkkachu
  • 148k
  • 16
  • 268
  • 441

I frequently refer to man bash to recall use of "history expansion" parts(events/words/modifiers). I know that the man part I need is "HISTORY EXPANSION". So I type in HISTORY EXPANSIONHISTORY EXPANSION in forward search list '/'. Of course less jumps not straightforward to the HISTORY EXPANSION"HISTORY EXPANSION" part, but instead shows all occurencesoccurrences of this string in given man. Thus, I thought it would be great to type something like: /^HISTORY EXPANSION so

/^HISTORY EXPANSION 

so I could jump to "start of line"HISTORY EXPANSION.

Neither /^HISTORY EXPANSION/^HISTORY EXPANSION nor /^HISTORY EXPANSION/\^HISTORY EXPANSION work

In less man I see that ... /pattern Search forward in the file for the N-th line containing the pattern. N defaults to 1. The pattern is a regular expression, as recognized by the regular expres‐ sion library supplied by your system.

/pattern
Search forward in the file for the N-th line containing the pattern. N defaults to 1. The pattern is a regular expression, as recognized by the regular expression library supplied by your system.

I see that other men were also looking into this, but with a different purpose: https://stackoverflow.com/questions/14698364/what-is-the-regular-expression-library-supplied-by-my-system

I followed the steps, but still cannot say for sure what regex version is used on my machine. Here is the shared lib dependencies output for less binary

$ ldd /usr/bin/less

$ ldd /usr/bin/less linux-vdso.so.1 => (0x00007ffc229cb000) libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f44968e9000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4496524000) /lib64/ld-linux-x86-64.so.2 (0x00007f4496b12000) 

So, how to indicate start of line in less search, so I can easily jump to the parts of man I need?

I frequently refer to man bash to recall use of "history expansion" parts(events/words/modifiers). I know that the man part I need is "HISTORY EXPANSION". So I type in HISTORY EXPANSION in forward search list '/'. Of course less jumps not straightforward to the HISTORY EXPANSION part, but instead shows all occurences of this string in given man. Thus, I thought it would be great to type something like: /^HISTORY EXPANSION so I could jump to "start of line"HISTORY EXPANSION.

Neither /^HISTORY EXPANSION nor /^HISTORY EXPANSION work

In less man I see that ... /pattern Search forward in the file for the N-th line containing the pattern. N defaults to 1. The pattern is a regular expression, as recognized by the regular expres‐ sion library supplied by your system.

I see that other men were also looking into this, but with a different purpose: https://stackoverflow.com/questions/14698364/what-is-the-regular-expression-library-supplied-by-my-system

I followed the steps, but still cannot say for sure what regex version is used on my machine. Here is the shared lib dependencies output for less binary

$ ldd /usr/bin/less

linux-vdso.so.1 => (0x00007ffc229cb000) libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f44968e9000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4496524000) /lib64/ld-linux-x86-64.so.2 (0x00007f4496b12000) 

So, how to indicate start of line in less search, so I can easily jump to the parts of man I need?

I frequently refer to man bash to recall use of "history expansion" parts(events/words/modifiers). I know that the man part I need is "HISTORY EXPANSION". So I type in HISTORY EXPANSION in forward search list '/'. Of course less jumps not straightforward to the "HISTORY EXPANSION" part, but instead shows all occurrences of this string in given man. Thus, I thought it would be great to type something like:

/^HISTORY EXPANSION 

so I could jump to "start of line"HISTORY EXPANSION.

Neither /^HISTORY EXPANSION nor /\^HISTORY EXPANSION work

In less man I see that ...

/pattern
Search forward in the file for the N-th line containing the pattern. N defaults to 1. The pattern is a regular expression, as recognized by the regular expression library supplied by your system.

I see that other men were also looking into this, but with a different purpose: https://stackoverflow.com/questions/14698364/what-is-the-regular-expression-library-supplied-by-my-system

I followed the steps, but still cannot say for sure what regex version is used on my machine. Here is the shared lib dependencies output for less binary

$ ldd /usr/bin/less linux-vdso.so.1 => (0x00007ffc229cb000) libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f44968e9000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4496524000) /lib64/ld-linux-x86-64.so.2 (0x00007f4496b12000) 

So, how to indicate start of line in less search, so I can easily jump to the parts of man I need?

Source Link

How to indicate start of line in less search?

I frequently refer to man bash to recall use of "history expansion" parts(events/words/modifiers). I know that the man part I need is "HISTORY EXPANSION". So I type in HISTORY EXPANSION in forward search list '/'. Of course less jumps not straightforward to the HISTORY EXPANSION part, but instead shows all occurences of this string in given man. Thus, I thought it would be great to type something like: /^HISTORY EXPANSION so I could jump to "start of line"HISTORY EXPANSION.

Neither /^HISTORY EXPANSION nor /^HISTORY EXPANSION work

In less man I see that ... /pattern Search forward in the file for the N-th line containing the pattern. N defaults to 1. The pattern is a regular expression, as recognized by the regular expres‐ sion library supplied by your system.

I see that other men were also looking into this, but with a different purpose: https://stackoverflow.com/questions/14698364/what-is-the-regular-expression-library-supplied-by-my-system

I followed the steps, but still cannot say for sure what regex version is used on my machine. Here is the shared lib dependencies output for less binary

$ ldd /usr/bin/less

linux-vdso.so.1 => (0x00007ffc229cb000) libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f44968e9000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4496524000) /lib64/ld-linux-x86-64.so.2 (0x00007f4496b12000) 

So, how to indicate start of line in less search, so I can easily jump to the parts of man I need?