Hacker News new | past | comments | ask | show | jobs | submit login

Sure, I'm saying that would be a fairer comparison - getting output from something that has no defined interface.

So why not compare apples to apples, how would powershell extract the MAC from ifconfig output? If that's more flexible or powerful than bash with standard UNIX tools, then that might be impressive!




> how would powershell extract the MAC from ifconfig output?

It could go identically crazy as in bash, as it has its own grep (sls), can use grep itself etc.

    > (ipconfig /all | sls Physical) -replace ".+: "
    00-FF-84-14-66-D7
    00-FF-B7-06-19-0F
    00-15-5D-00-1F-3C
    ...


Right, that's a fairer comparison. So the question is, why is that better?


Its not. Everything else is.

Although, on more thought, it is better even as parsing engine as you have system design rules enforced across tools and OSes. Even single tool may work differently depending on *nix flavor.


Here's what I got:

ifconfig | ?{$_ -like "eth0 *"} | %{($_ -Split " ")[-1]}

In other words, find the line that starts with "eth0 ", then return the last column using " " as a delimiter.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: