Operating System - Linux
1827769 Members
2978 Online
109969 Solutions
New Discussion

Re: List files and see with more

 
Mauro_8
Frequent Advisor

List files and see with more

Hi,

How can I list all files with extension .h and see the source code of each one ?

Like this:
find / -name '*.h' | more ...

I want to use more with the results of find.

Any ideas ?

Cheers,
Mauro
5 REPLIES 5
Mark Grant
Honored Contributor

Re: List files and see with more

you could do find / -name "*.h" -exec more {} \;
Never preceed any demonstration with anything more predictive than "watch this"
Jerome Henry
Honored Contributor

Re: List files and see with more

find / -name '*.h' | more redirects find command in more command, what you want to do is display the content, this can be done thru cat :
find / -name '*.h' | cat '*.h' | more

hth

J
You can lean only on what resists you...
Dave Falloon
Trusted Contributor

Re: List files and see with more

You can also use xargs like this:


find . -name \*.h |xargs more

I like xargs because its shorter to write than -exec more {} ';'

Dave
Clothes make the man, Naked people have little to no effect on society
Balaji N
Honored Contributor

Re: List files and see with more

more `find / -name "*.h"`

-b-
Its Always Important To Know, What People Think Of You. Then, Of Course, You Surprise Them By Giving More.
Huc_1
Honored Contributor

Re: List files and see with more

I know this is not exactly what you wanted ask for, but I find I use emacs more often the more
mainly because it come with colors on file extension it know about.

also you can click and get a list of the buffer, and click to an other buffer

so I find the following more usefull.

find . -name \*.html | xargs emacs

but it is realy a how do you like your tea question !

enjoy

J-P
Smile I will feel the difference