-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/9/10 21:16 , Jan L. Peterson wrote:
> (eval `for m in *.meta; do f=\`awk '/^Filter:/ { print $2; exit }' $m\`; echo 
> -n "./$f -r \`basename $m .meta\` |"; done | sed -e "s/|$//"`) < input > 
> output

I would use $() instead of `` because the quoting is a lot easier to deal
with; in particular, the inner \` ... \` doesn't need the backwhacks if you
use $() instead.

Other observations:  Paul Graydon suggested find, but you probably want to
use -maxdepth (warning, not in POSIX).

Untested but should be close:

eval "$(echo -n "< $input "
        find . -maxdepth 1 -name '*.meta' -print0 |
        xargs -0 awk '/Filter:/ {gsub(".", "\\&", $2);
                                 f = $2;
                                 sub("\\.\\m\\e\\t\\a$", "", f);
                                 print "./" $2, "-r", f, "|";
                                 nextfile }' |
        sed '$s/|$/>output/')"

- -- 
brandon s. allbery     [linux,solaris,freebsd,perl]      [email protected]
system administrator  [openafs,heimdal,too many hats]  [email protected]
electrical and computer engineering, carnegie mellon university      KF8NH
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0Ce54ACgkQIn7hlCsL25XuTQCbBCBRcamW4habNc9ocrt4Z9Ow
LSwAoKp/VTpmfQx9Wuqca0v6GDjxjy/I
=7Gvp
-----END PGP SIGNATURE-----
_______________________________________________
Discuss mailing list
[email protected]
https://lists.lopsa.org/cgi-bin/mailman/listinfo/discuss
This list provided by the League of Professional System Administrators
 http://lopsa.org/

Reply via email to