We have multiple servers and i would like to print users list and access level using bash.
I tried below command but could not get exact result what i wanted to:
awk '/Allow root/{p=5} p > 0 {print $1; p--}' /etc/sudoers
above command just give me five entries as below
##
root
abcd
ghfd
fcff
but I should get the O/P as below:
UserList AccessLevel
root ALL
abcd !/usr/bin/*
Can i get the output as above?
After doing so much experiments i am able to achieve it as close as possible by below command.
and the output is as below:
But still i am getting space separated output. i want to skip that spaces in output.