patchutils, xargs ftw

Christoph Berg myon at debian.org
Mon Jan 26 08:27:04 UTC 2009


Hi,

patchutils has a trac:

[patchutils]
type     = trac
uri      = https://fedorahosted.org/patchutils


xargs is several orders of magnitude faster than find -exec in this
script:

diff --git a/bts-link_merkel.sh b/bts-link_merkel.sh
index 539d50f..43bb38e 100755
--- a/bts-link_merkel.sh
+++ b/bts-link_merkel.sh
@@ -3,7 +3,7 @@
 # extract data from the bts mirror (we need only summary files)
 # we need only the file for forwarded bugs (forwarded to http links)
 # then we parse data to "<bugs nnn>: <url>", sort and add to index.fwd file
-find /org/bugs.debian.org/spool/db-h/ -name "*.summary" -exec grep -H '^Forwarded-To' {} \; | grep 'http[s]*://' | se
d -e 's~^\(.*\)/\([0-9]*\).summary:Forwarded-To:~\2:~' | sort > index.fwd.new
+find /org/bugs.debian.org/spool/db-h/ -name "*.summary" | xargs grep -H '^Forwarded-To' | grep 'http[s]*://' | sed -e
 's~^\(.*\)/\([0-9]*\).summary:Forwarded-To:~\2:~' | sort > index.fwd.new
 
 # replace "real" file
 mv index.fwd.new index.fwd

Christoph
-- 
cb at df7cb.de | http://www.df7cb.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/bts-link-devel/attachments/20090126/7f8df27c/attachment.pgp 


More information about the Bts-link-devel mailing list