How to indicate start of line in less search of man pages?
Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
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?
regular-expression man less
 |Â
show 8 more comments
up vote
3
down vote
favorite
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?
regular-expression man less
1
Typing/^HISTORY EX
followed by return works for me in the manual ofbash
on a Linux system. I can't reproduce your issue.
â Kusalananda
Jan 22 at 11:09
man is not really appropriate for a manual this big. I would recommand formats with support for index and/or table of content, likeinfo
with which you have a searchable index (i
, then typehistory expansion
with tab completion)
â Stéphane Chazelas
Jan 22 at 11:10
Possibly related: Grep: unexpected results when searching for words in heading from man page
â Stéphane Chazelas
Jan 22 at 11:11
IOW, I can reproduce your issue if I runman
asGROFF_SGR=1 MANPAGER='less -r' man bash
. You'd want to make sureless
is run with-R
instead of-r
(for it do understand those SGR escape sequences as opposed to pass them through), or useGROFF_NO_SGR
to revert to the traditional way of doing bold/underline.
â Stéphane Chazelas
Jan 22 at 11:28
@Kusalananda set PAGER=more, and your search will fail.
â Gerard H. Pille
Jan 22 at 11:29
 |Â
show 8 more comments
up vote
3
down vote
favorite
up vote
3
down vote
favorite
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?
regular-expression man less
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?
regular-expression man less
edited Jan 22 at 12:05
Gerard H. Pille
1,219212
1,219212
asked Jan 22 at 11:05
ortymd
385
385
1
Typing/^HISTORY EX
followed by return works for me in the manual ofbash
on a Linux system. I can't reproduce your issue.
â Kusalananda
Jan 22 at 11:09
man is not really appropriate for a manual this big. I would recommand formats with support for index and/or table of content, likeinfo
with which you have a searchable index (i
, then typehistory expansion
with tab completion)
â Stéphane Chazelas
Jan 22 at 11:10
Possibly related: Grep: unexpected results when searching for words in heading from man page
â Stéphane Chazelas
Jan 22 at 11:11
IOW, I can reproduce your issue if I runman
asGROFF_SGR=1 MANPAGER='less -r' man bash
. You'd want to make sureless
is run with-R
instead of-r
(for it do understand those SGR escape sequences as opposed to pass them through), or useGROFF_NO_SGR
to revert to the traditional way of doing bold/underline.
â Stéphane Chazelas
Jan 22 at 11:28
@Kusalananda set PAGER=more, and your search will fail.
â Gerard H. Pille
Jan 22 at 11:29
 |Â
show 8 more comments
1
Typing/^HISTORY EX
followed by return works for me in the manual ofbash
on a Linux system. I can't reproduce your issue.
â Kusalananda
Jan 22 at 11:09
man is not really appropriate for a manual this big. I would recommand formats with support for index and/or table of content, likeinfo
with which you have a searchable index (i
, then typehistory expansion
with tab completion)
â Stéphane Chazelas
Jan 22 at 11:10
Possibly related: Grep: unexpected results when searching for words in heading from man page
â Stéphane Chazelas
Jan 22 at 11:11
IOW, I can reproduce your issue if I runman
asGROFF_SGR=1 MANPAGER='less -r' man bash
. You'd want to make sureless
is run with-R
instead of-r
(for it do understand those SGR escape sequences as opposed to pass them through), or useGROFF_NO_SGR
to revert to the traditional way of doing bold/underline.
â Stéphane Chazelas
Jan 22 at 11:28
@Kusalananda set PAGER=more, and your search will fail.
â Gerard H. Pille
Jan 22 at 11:29
1
1
Typing
/^HISTORY EX
followed by return works for me in the manual of bash
on a Linux system. I can't reproduce your issue.â Kusalananda
Jan 22 at 11:09
Typing
/^HISTORY EX
followed by return works for me in the manual of bash
on a Linux system. I can't reproduce your issue.â Kusalananda
Jan 22 at 11:09
man is not really appropriate for a manual this big. I would recommand formats with support for index and/or table of content, like
info
with which you have a searchable index (i
, then type history expansion
with tab completion)â Stéphane Chazelas
Jan 22 at 11:10
man is not really appropriate for a manual this big. I would recommand formats with support for index and/or table of content, like
info
with which you have a searchable index (i
, then type history expansion
with tab completion)â Stéphane Chazelas
Jan 22 at 11:10
Possibly related: Grep: unexpected results when searching for words in heading from man page
â Stéphane Chazelas
Jan 22 at 11:11
Possibly related: Grep: unexpected results when searching for words in heading from man page
â Stéphane Chazelas
Jan 22 at 11:11
IOW, I can reproduce your issue if I run
man
as GROFF_SGR=1 MANPAGER='less -r' man bash
. You'd want to make sure less
is run with -R
instead of -r
(for it do understand those SGR escape sequences as opposed to pass them through), or use GROFF_NO_SGR
to revert to the traditional way of doing bold/underline.â Stéphane Chazelas
Jan 22 at 11:28
IOW, I can reproduce your issue if I run
man
as GROFF_SGR=1 MANPAGER='less -r' man bash
. You'd want to make sure less
is run with -R
instead of -r
(for it do understand those SGR escape sequences as opposed to pass them through), or use GROFF_NO_SGR
to revert to the traditional way of doing bold/underline.â Stéphane Chazelas
Jan 22 at 11:28
@Kusalananda set PAGER=more, and your search will fail.
â Gerard H. Pille
Jan 22 at 11:29
@Kusalananda set PAGER=more, and your search will fail.
â Gerard H. Pille
Jan 22 at 11:29
 |Â
show 8 more comments
2 Answers
2
active
oldest
votes
up vote
1
down vote
When man's output passes through more, each bold character is in fact that character, followed by a backspace, followed by repeating that character and then to the next character. To find something in bold, search for /^H..I..S..T
You'll find it also in the article Stéphane pointed to.
1
Butless
understands those and its search facility will work on the rendered text. It's different though when roff uses SGR escape sequences for bold/underline andless
is called with-r
.
â Stéphane Chazelas
Jan 22 at 11:31
add a comment |Â
up vote
0
down vote
accepted
Having tried and experimented it appears that man actually indents lines with spaces. This is the reason I could find /^HISTORY EXPANSION
and failed with/^The history library
(This is the first sentence in HISTORY EXPANSION section). Here is the correct pattern:/^[[:space:]]7The history library...
As we can see man/less simply adds 7 "spaces"(ascii dec code 32) in front of each line that is not a section header (in bold, as I see other people speak).
I cannot say for sure whether this is true with all Linux distros/man binaries, but with all I tested so far this is true. To sum up in order to find(from first search) description of '-atime' option in man find use/^[[:space:]]7-atime
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
When man's output passes through more, each bold character is in fact that character, followed by a backspace, followed by repeating that character and then to the next character. To find something in bold, search for /^H..I..S..T
You'll find it also in the article Stéphane pointed to.
1
Butless
understands those and its search facility will work on the rendered text. It's different though when roff uses SGR escape sequences for bold/underline andless
is called with-r
.
â Stéphane Chazelas
Jan 22 at 11:31
add a comment |Â
up vote
1
down vote
When man's output passes through more, each bold character is in fact that character, followed by a backspace, followed by repeating that character and then to the next character. To find something in bold, search for /^H..I..S..T
You'll find it also in the article Stéphane pointed to.
1
Butless
understands those and its search facility will work on the rendered text. It's different though when roff uses SGR escape sequences for bold/underline andless
is called with-r
.
â Stéphane Chazelas
Jan 22 at 11:31
add a comment |Â
up vote
1
down vote
up vote
1
down vote
When man's output passes through more, each bold character is in fact that character, followed by a backspace, followed by repeating that character and then to the next character. To find something in bold, search for /^H..I..S..T
You'll find it also in the article Stéphane pointed to.
When man's output passes through more, each bold character is in fact that character, followed by a backspace, followed by repeating that character and then to the next character. To find something in bold, search for /^H..I..S..T
You'll find it also in the article Stéphane pointed to.
answered Jan 22 at 11:29
Gerard H. Pille
1,219212
1,219212
1
Butless
understands those and its search facility will work on the rendered text. It's different though when roff uses SGR escape sequences for bold/underline andless
is called with-r
.
â Stéphane Chazelas
Jan 22 at 11:31
add a comment |Â
1
Butless
understands those and its search facility will work on the rendered text. It's different though when roff uses SGR escape sequences for bold/underline andless
is called with-r
.
â Stéphane Chazelas
Jan 22 at 11:31
1
1
But
less
understands those and its search facility will work on the rendered text. It's different though when roff uses SGR escape sequences for bold/underline and less
is called with -r
.â Stéphane Chazelas
Jan 22 at 11:31
But
less
understands those and its search facility will work on the rendered text. It's different though when roff uses SGR escape sequences for bold/underline and less
is called with -r
.â Stéphane Chazelas
Jan 22 at 11:31
add a comment |Â
up vote
0
down vote
accepted
Having tried and experimented it appears that man actually indents lines with spaces. This is the reason I could find /^HISTORY EXPANSION
and failed with/^The history library
(This is the first sentence in HISTORY EXPANSION section). Here is the correct pattern:/^[[:space:]]7The history library...
As we can see man/less simply adds 7 "spaces"(ascii dec code 32) in front of each line that is not a section header (in bold, as I see other people speak).
I cannot say for sure whether this is true with all Linux distros/man binaries, but with all I tested so far this is true. To sum up in order to find(from first search) description of '-atime' option in man find use/^[[:space:]]7-atime
add a comment |Â
up vote
0
down vote
accepted
Having tried and experimented it appears that man actually indents lines with spaces. This is the reason I could find /^HISTORY EXPANSION
and failed with/^The history library
(This is the first sentence in HISTORY EXPANSION section). Here is the correct pattern:/^[[:space:]]7The history library...
As we can see man/less simply adds 7 "spaces"(ascii dec code 32) in front of each line that is not a section header (in bold, as I see other people speak).
I cannot say for sure whether this is true with all Linux distros/man binaries, but with all I tested so far this is true. To sum up in order to find(from first search) description of '-atime' option in man find use/^[[:space:]]7-atime
add a comment |Â
up vote
0
down vote
accepted
up vote
0
down vote
accepted
Having tried and experimented it appears that man actually indents lines with spaces. This is the reason I could find /^HISTORY EXPANSION
and failed with/^The history library
(This is the first sentence in HISTORY EXPANSION section). Here is the correct pattern:/^[[:space:]]7The history library...
As we can see man/less simply adds 7 "spaces"(ascii dec code 32) in front of each line that is not a section header (in bold, as I see other people speak).
I cannot say for sure whether this is true with all Linux distros/man binaries, but with all I tested so far this is true. To sum up in order to find(from first search) description of '-atime' option in man find use/^[[:space:]]7-atime
Having tried and experimented it appears that man actually indents lines with spaces. This is the reason I could find /^HISTORY EXPANSION
and failed with/^The history library
(This is the first sentence in HISTORY EXPANSION section). Here is the correct pattern:/^[[:space:]]7The history library...
As we can see man/less simply adds 7 "spaces"(ascii dec code 32) in front of each line that is not a section header (in bold, as I see other people speak).
I cannot say for sure whether this is true with all Linux distros/man binaries, but with all I tested so far this is true. To sum up in order to find(from first search) description of '-atime' option in man find use/^[[:space:]]7-atime
answered Jan 24 at 17:39
ortymd
385
385
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f418829%2fhow-to-indicate-start-of-line-in-less-search-of-man-pages%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
Typing
/^HISTORY EX
followed by return works for me in the manual ofbash
on a Linux system. I can't reproduce your issue.â Kusalananda
Jan 22 at 11:09
man is not really appropriate for a manual this big. I would recommand formats with support for index and/or table of content, like
info
with which you have a searchable index (i
, then typehistory expansion
with tab completion)â Stéphane Chazelas
Jan 22 at 11:10
Possibly related: Grep: unexpected results when searching for words in heading from man page
â Stéphane Chazelas
Jan 22 at 11:11
IOW, I can reproduce your issue if I run
man
asGROFF_SGR=1 MANPAGER='less -r' man bash
. You'd want to make sureless
is run with-R
instead of-r
(for it do understand those SGR escape sequences as opposed to pass them through), or useGROFF_NO_SGR
to revert to the traditional way of doing bold/underline.â Stéphane Chazelas
Jan 22 at 11:28
@Kusalananda set PAGER=more, and your search will fail.
â Gerard H. Pille
Jan 22 at 11:29