Reply to post: Re: Like grep? sed? awk?

Microsoft points PowerShell at Penguinistas

thames

Re: Like grep? sed? awk?

@h4rm0ny - "Now lets see what it looks like on GNU/Linux:

find ./ -exec ls -l {} \; | awk '{print $3}' | grep . | sort | uniq"

I would suggest using:

find . -print0 | xargs -0 stat -c "%U" | sort | uniq

It's simpler and orders of magnitude faster. Stat has loads of options to give you information on just about anything about a file.

You might find

DIR -Recurse | Get-Acl | Select-Object Owner | Select -Unique

easier because you're used to it, but Linux administrators would see "find", "xargs", "stat", "sort", and "uniq" to be familiar to them.

I have to admit though that you've come up with a unique way of solving the problem. I doubt that I would have ever thought of trying it that way.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Biting the hand that feeds IT © 1998–2019