Im trying to print /etc/passwd with a variable connecting to /etc group/
But when im trying to print the output, /etc/group is printing also. Can i ask for help on what command to use
so it will ignore /etc/group and only print /etc/passwd.
here's the sample script. pages number and the /10 entry line pages should be used also.
awk -F":" -v A=$(wc -l < /etc/passwd) '
BEGIN {
NUM_PAGES=A/10+1
print "--------------------------------------------------"
printf "%-20s %-20s %-3s\n","USERNAME","GUID","DIRECTORY"
print "--------------------------------------------------"
}
!(NR%10) {
PAGE++
printf "--- Page %d of %d ---",PAGE,NUM_PAGES
getline rc < "-"; system("tput cuu1")
}
(NR==FNR){
B[$3]=$1
next } $4 in B { $4=B[$4]
}
{ printf "%-20s %-20s %-3s\n", $1, $4, $7 }
' /etc/group /etc/passwd