Mailinglist Archive: opensuse (3135 mails)

< Previous Next >
Re: [opensuse] multiple tasks
  • From: Vince Oliver <vince@xxxxxxxxxxxxxxx>
  • Date: Fri, 9 Mar 2007 22:41:32 +0100 (CET)
  • Message-id: <Pine.LNX.4.62.0703092228110.22187@xxxxxxxxxxxxxx>


On Fri, 9 Mar 2007, Philippe Andersson wrote:

Vince Oliver wrote:
Hi All,

I really enjoy command that I learnd few days ago. It finds directories
with a particular names and do removing of particular files. Something like

find DH* -type f -name "*.dat" -exec rm {} \;

I was wandering, is it posible to 'employ' awk,sed or other commands in
similar manner and how?.
It's certainly possible using pipes ('|'). Example:

$ find DH* -type f -name "*.dat" -exec cksum {} \; | awk '{ print $1 }'

For intance to find all "*.dat" in all DH* dirs
(like above) and calculate average of $3 by awk
Not sure what you want to do here:
- what is $3 in this case ?
- calculate the average what ? Size ? Number of .dat files per directory ?

HTH

Cheers. Bye.

Ph. A.

 thanks for reply


I was not precise enough

I would just like to know if I could do more then one tast with the -exec. For example to remove all "*dat" files from DH1 and list the content with ls, to remove all "*.dat" from DH2 and list and so on ... for each DH* file

This attempt

 find DH* -type f -name "*.dat" -exec rm {} \; | ls

does not work properly





--

*Philippe Andersson*
Unix System Administrator
IBA Particle Therapy |
Tel: +32-10-475.983
Fax: +32-10-487.707
eMail: pan@xxxxxxxxxxxxx
<http://www.iba-worldwide.com>





The contents of this e-mail message and any attachments are intended solely for
the recipient (s) named above. This communication is intended to be and to
remain confidential and may be protected by intellectual property rights. Any
use of the information contained herein (including but not limited to, total or
partial reproduction, communication or distribution of any form) by persons
other than the designated recipient(s) is prohibited. Please notify the sender
immediately by e-mail if you have received this e-mail by mistake and delete
this e-mail from your system. E-mail transmission cannot be guaranteed to be
secure or error-free. Ion Beam Applications does not accept liability for any
such errors. Thank you for your cooperation.
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups