Review inactive accounts
Select inactive human accounts for review without changing account state.
A review list is not a deletion list
An account inventory can help administrators find identities needing attention. Last-login age is one signal, but service accounts, disabled accounts and human accounts have different operational meanings. Apply the stated policy rather than treating every old timestamp as permission to remove access.
This export supplies kind, locked state and integer age_days. It is a snapshot from a fictional collector, not a call to local user-management tools. The exercise selects unlocked human accounts with no login for at least 90 days. An account exactly at the boundary is included; a service account is excluded even when very old.
Preserve the reason for selection
Emit the original account name, age and a stable reason. Another administrator can then review ownership, retention requirements and exceptions before taking action. Do not replace a missing activity value with zero; the supplied lesson data is validated, while a production importer should distinguish unknown activity explicitly.
Use exact comparisons for kind and locked status. Substring matching could accidentally include a value with a different meaning. Sorting under LC_ALL=C gives a predictable handover list. The script must not invoke account-management commands: all required work is analysis of the supplied file, which remains unchanged.
awk -F '\t' 'NR>1 {printf "%s is a %s account\n",$1,$2}' accounts.tsv
Put it into practice.
accounts.tsv has validated unique user<TAB>kind<TAB>locked<TAB>age_days records. Kind is human or service, locked is yes or no, and age is a nonnegative integer. Print user<TAB>age_days<TAB>reason for unlocked human accounts aged at least 90 days, sorted by user in LC_ALL=C order. Reason is inactive_human. Do not include locked or service accounts and do not change the export.
See an explained solution
export LC_ALL=C
printf 'user\tage_days\treason\n'
awk -F '\t' 'NR>1 && $2=="human" && $3=="no" && $4>=90 {printf "%s\t%d\tinactive_human\n",$1,$4}' accounts.tsv | sort
The predicate keeps account type and current lock state separate from age. The inclusive threshold selects the intended boundary, while the report provides a reviewable recommendation without changing any account.