Is awk vs cut which one is better
i was trying to work on program to look for users never log on sever.. using awk
with awk is working
last| awk '{print $1}' |sort -u > /tmp/users1$$
cat /etc/passwd | awk -F: '{print $1}' |sort -u > /tmp/users2$$
comm -13 /tmp/users[12]$$
rm -f /tmp/users[12]$$
with cut it is not working
last| cut -c1-10 |sort -u > /tmp/users1$$
cat /etc/passwd |cut -d':' -f1 | sort -u > /tmp/users2$$
comm -13 /tmp/users[12]$$
rm -f /tmp/users[12]$$
i have another idea by using for loop and count number users repeated. if anyone has better idea to solve this problem please help.
|