On Dec 9, 2010, at 6:49 PM, [email protected] wrote:
> basename to eliminate one cut is a good point (I know about the command, but 
> it's not something I commonly use), is it really any faster for this (since 
> they both need to execute a command)

I don't know if it's much faster, but basename isn't handling any input like 
cut would be doing.  Everything it needs is handed to it as an argument.

> but what happens if the grep "^Filter:" returns more than one item? won't all 
> of them become part of f?

The "exit" in the awk command takes care of it.  It will exit after the first 
print.  And, in fact, since I'm using awk, my use of grep isn't really 
required, either!

Taking everyone's suggestions into account, try this:

(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

The shell is cool.

        -jan-
-- 
Jan L. Peterson
http://www.peterson-tech.com/~jlp/




_______________________________________________
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