3 ms·
And how it's better, than sed/awk? xo: function shh() { ssh $(cat servers.yml | xo "/.?($1):\sserver:\s+([^:\n]+):?(\d+)?.?user:\s+([^\n]+)./\$4@\$2
by seletskiy 11y ago
And how it's better, than sed/awk?
xo:
function shh() {
ssh $(cat servers.yml | xo "/.?($1):\sserver:\s+([^:\n]+):?(\d+)?.?user:\s+([^\n]+)./\$4@\$2 -p \$3?:22/mis")
}
sed:
function shh() {
ssh $(cat servers.yml | sed -nre'/'$1':/{n;N;s/.: ([^:]+)(:(.))?\n.: (.)/\4@\1 -p\3/;s/-p$//;p}')
}