Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: _hosts



On Fri, Feb 03, 2006 at 03:46:08PM +0000, Peter Stephenson wrote:

> I've also made the function search ~/.ssh/known_hosts for host names
> (and strip out IPv4 dot addresses).
>
> [ ... ]
>
>     sed -e '/^[0-9]*\.[0-9]*\.[0-9]*\.[0-9]/d' -e 's/[ ,].*//p' ~/.ssh/known_hosts

Might want to strip out IPv6 addresses as well:

  -e '/^[0-9a-f]\{0,4\}:/d'

And I'm not sure I see what the "/p" is doing there, other than doubling
each entry.  Would

    ${${${(u)${(f)"$(<~/.ssh/known_hosts)"}%%[ ,]*}:#(#s)[0-9]##.[0-9]##.[0-9]##.[0-9]##(#e)}:#(#s)[0-9a-f:]##(#e)}

be any better (if more arcane)?

Danek



Messages sorted by: Reverse Date, Date, Thread, Author