0

I was trying to search in man find, and I would like to know what's going on.

$ man find | grep Like Like -lname, but the match is case insensitive. This is a GNU Like -name, but the match is case insensitive. Like -path, but the match is case insensitive. Like -regex, but the match is case insensitive. Like -name, but the contents of the symbolic link are matched $ man find | grep "\-name" find / \! -name "*.c" -print find /usr/src -name CVS -prune -o -depth +6 -print find /usr/src -name CVS -prune -o -mindepth 7 -print $ man find | grep "name," and there is no such group name, then gname is treated as a group and there is no such user name, then uname is treated as a user 

What's going on? How come I can see lines that contain -name, but I don't get those results if I search for -name or name, and why does that show different things? I imagine it has to do with some “metadata” in man page not shown in the terminal, but I don't know.

3
  • I don't think that's the problem. Commented Feb 4, 2019 at 18:54
  • In my debian , using gnu grep 3.3 , the results of grep 'name' are much more compared to grep '\-name' and includes all the results provided by '\-name'. I suppose this behavior you encounter is in your grep implementation. Commented Feb 4, 2019 at 20:06
  • @GeorgeVasiliou I used grep 'name,'. Commented Feb 4, 2019 at 21:32

1 Answer 1

5

The default formatting from the man page (such as for bold words) is done by interspersing control characters and letters (and the control characters aren't easily visible in the output).

$ grep 'This is a GNU' /tmp/find.out Like -lname, but the match is case insensitive. This is a GNU $ grep 'This is a GNU' /tmp/find.out | od -c 0000000 L i k 0000020 e - \b - l \b l n \b n a \b a m \b 0000040 m e \b e , b u t t h e m a 0000060 t c h i s c a s e i n s e 0000100 n s i t i v e . T h i s i 0000120 s a G N U \n 

You can see the backspace/overstrike pairs in the -name word. It looks fine when printed, but means that name isn't a sequence of characters in the output.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.