[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Include Collector (may be OT)

On Wed, Jul 26, 2000 at 04:30:35PM -0500, Bolan Meek wrote:
> I've never used uniq, though I've seen it in the man page listing...
> Anyway, the command pipe above isn't working...
> `grep include *.c` shows all my includes.  `grep include *.c | uniq -d`
> isn't showing any.
> Here are the contents (in my test, all I have are #include statements):
> The "ex?.c" at the beginning of each makes each line unique, so uniq -d
> can't
> process.  Also the \s+ in your egrep command can't match ^#include ...
> Thanks anyway:  I know I could strip out the ex?.c, but this still
> doesn't
> get me what I want...

Try this :

cat *.[ch] | pgrep '^\s*#include\s+<<' | perl -pe 's/^\s*#include\s+<//; s/>//' | sort | uniq

Reply to: