Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

using the Find command

5 views
Skip to first unread message

Jerome Robertson

unread,
Mar 19, 2010, 7:15:32 PM3/19/10
to
I want to execute the File command on every file in /etc/sysconfig and
record the output in a file named sysconfig.find

Here is what I tried that didn't work:

find /etc/sysconfig -exec file {} /home/JR/sysconfig.find \; 2>/dev/null

I can't see why this command won't work.

SM

unread,
Mar 19, 2010, 7:33:47 PM3/19/10
to
2010-03-19, Jerome Robertson skribis:

I usually do it via xargs:

find /etc/sysconfig -type f -print0 | xargs -0 file > /home/JR/sysconfig.find

--
kasmra
:wq

Florian Diesch

unread,
Mar 19, 2010, 8:00:59 PM3/19/10
to
Jerome Robertson <consi...@earthlink.net> writes:

> I want to execute the File command on every file in /etc/sysconfig and
> record the output in a file named sysconfig.find
>
> Here is what I tried that didn't work:
>
> find /etc/sysconfig -exec file {} /home/JR/sysconfig.find \; 2>/dev/null

That doesn't write any output in /home/JR/sysconfig.find but calls file
on the found file and /home/JR/sysconfig.find

Try


find /etc/sysconfig -exec file {} \; > /home/JR/sysconfig.find

Florian
--
<http://www.florian-diesch.de/software/shell-scripts/>

0 new messages