I want to write a Unix command which select a random user from /etc/passwd and check a remote host using SHH to determine if a user with the same UID exists, print out the full line from passwd if the user exists.
Here is the command I wrote so far:
echo `shuf -n 1 /etc/passwd | cut -d ":" -f 3' | ssh 100.64.0.2 sed -n -e '/**xargs**/p' /etc/passwd
Seems like the sed command doesn't take xargs as a argument from local machine, but a text
Any idea would be very appreciated!