Upon further review, it would be better to search for the user only at the beginning of the line in passwd to avoid finding lines which had the same string as a user name further along. Also the {print} is not necessary as it is the default. This results in the following solution:
I believe some older awks do not allow the program to come from stdin. In this case, you would need to redirect the output from the first awk to a temporary file and use this file as the program for the second awk.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.