So I used:
getent passwd $2 | awk -F: '{print "|Username: " $1 "\n|Password: " $2 "\n|Uid: " $3 "\n|Gid: " $4 "\n|Comment: " $5 "\n|Home: " $6 "\n|Shell: " $7 "\n"}'
to pipe user info in to a neat list.
I wanted to do the same with folders. I want all the information from the ' ls -l' command but instead of it coming out like a block of test I wanted it listed piece by piece.
Can I use an awk
command together with ls
and can I use the same method I did earlier?
ls -l
output are not unambiguously delimited like those in thepasswd
database. See for example Why not parsels
(and what to do instead)? – steeldriver Feb 18 '20 at 14:57groups | sed 's/ /, /g;s/^/Groups: /'
at the last line of your script. – Jetchisel Feb 19 '20 at 05:26