|
|
|
|
|
by ColinWright
4774 days ago
|
|
Yes, I've inserted the "g" in the appropriate sed commands. Thanks - good catch. Some systems seem to require \r instead of \n - I know vim's behavior differs from sed's in this, so that might be an issue. With xargs balking, you can throw the error stream at that point, for convert it to a loop over the alleged commands: for c in $( long thing before the xargs )
do
which $c
done \
| long thing after the xargs.
Specifically: for f in $( \
history \
| sed "s/^[0-9 ]*//" \
| sed "s/ *| */\n/g" \
| awk '{print $1}' \
)
do
which $f 2> /dev/null
done \
| sed "s.^/usr.." \
| grep ^.bin \
| sed "s/^.*\///" \
| sort \
| uniq -c \
| sort -rn \
> commands.txt
And yes spaces are a pig, and can lead to all sorts of ambiguities that don't have reasonable ways of resolving them, especially in filenames. |
|