3 ms·
Show HN: xo – utility that takes input from stdin and formats the regexp matches
- seletskiy 11y agoAnd 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}') }