1

I tried ack -f --cpp --nohh but it returns no results.

I'm using 2.14 on OSX.

Serenity
  • 35,289
  • 20
  • 120
  • 115
Kenny
  • 675
  • 10
  • 24
  • what about good old find? `find . -type f -name '*.cpp'` – Dimitri Podborski May 27 '16 at 21:33
  • 1
    @incBrain 'find' is an old friend. Just trying to learn a new tool. Also I eventually want to search for content within just the .cpp files. – Kenny May 27 '16 at 23:48
  • I use grep to do this. `grep -rnw . --include=\*.{cpp,cc} -e 'std::cout'` . [This post](http://stackoverflow.com/a/16957078/3734222) explains it really well. But learning new things is always a good idea. I never heard about `ack` thank you for this, I also will take a look at it :) – Dimitri Podborski May 27 '16 at 23:59
  • Ugh. My bad. The directory tree only had .c and .h. `ack -f --cc --nohh` lists only .c as expected. – Kenny May 28 '16 at 01:27

1 Answers1

2

I apparently misread the question. I thought that the question implied that the user was seeing source files but not headers. If the desire is to show source files but not headers, the command stream ack -f --cpp --nohh should give the desired results and works for me. However, I have a number of samples of C and C++ code in my personal directory. What is your working directory when running the command? Do you have source and header files in your directory.

I am sorry if I misread your question.

http://beyondgrep.com is the web site for ack

... Previous answer

if you look at man ack, --nohh means to not include header files.

I just ran ack -f --hh --cpp on my Mac OS X with ack 2.12 and a great many header files appeared.

...

I am using Mac OS X El Capitan (Version 10.11.5) with ack 2.12

Bradley Ross
  • 445
  • 2
  • 8