3

The output of man icc contains

   -Ldir

          Tells the linker to search for libraries...

Doing man icc | grep "\-L" gives back the "-Ldir" line while man icc | grep "\-Ldir" does not. What am I doing wrong here?

6
  • Btw the title is very generic but since I have no clue what the problem is I couldn't think of a better one. Maybe if I'll get an answer I'll be able to improve it. Dec 23, 2014 at 8:41
  • does man icc | grep -e "\-Ldir" work? Dec 23, 2014 at 8:45
  • No it does not. I also tried man icc | grep -- "-Ldir" and it did not work. Dec 23, 2014 at 9:15
  • 1
    Does man icc | grep -e "-L" | cat -v show anything between -L and dir ? Dec 23, 2014 at 10:56
  • Indeed it does: -^H-L^HLd^Hdi^Hir^H. I did not think of the usage of unprintable characters inside words. Accepted the answer of terdon as it points in the same direction. Dec 26, 2014 at 18:44

2 Answers 2

2

Your second command fails because there is probably a non-printing character between the L and dir. I can't tell you what since I don't have icc or its man page but you can test this by running

man icc | grep '\-L' | od -c

That will probably show something between the -L and the dir.

By the way, many programs, including grep use -- to signify the end of options and everything after -- is not parsed as an option. Therefore, you don't need the quotes:

man icc | grep -- -L
1
  • You are right. Running your od command revealed that many "\b" chars are used in the man page inside words for some reason. Dec 26, 2014 at 18:38
0

http://scv.bu.edu/computation/bladecenter/manpages/icc.html

Shows the man page as

-L<dir>

and not

-Ldir

What does man icc | grep "\-L.dir" return?

2
  • Unfortunately it returns nothing. The man excerpt I included in my answer is copy pasted from the man page as it appears on my machine. Dec 23, 2014 at 9:16
  • man gcc | /bin/grep "\-Ldir" works properly on my system. (I don't have icc installed.) Try entering bash and executing your original command with the full path to grep. Dec 23, 2014 at 9:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .