Link to home
Start Free TrialLog in
Avatar of aapl
aapl

asked on

Unix script to parse password file information

I am trying to create a script that will pull information from the comment field in the password file, What I want to do is:
for every entry in "ls /home"  I want to get the first initial and the last name from the First Last name entry in the comment field of the password file. The username would work in most cases but in some cases the username is truncated to 8 char, so for that reason I need to get this information.

 jalberso:x:1002:1000:Jaskson Alberson:/home/jalderso:/usr/bin/bash

so in a case like the above example, I want the output of jalberson
ASKER CERTIFIED SOLUTION
Avatar of psv1973
psv1973
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aapl
aapl

ASKER

Yea, that's exactly what I needed, yea the awk portion I already had down, it was the cut that I was stumbling on....


Thanks!!