Artificial intelligent assistant

Extract a word from a line Created a file employees: 1. Fred 2. Billy 1 3. Sally 1 4. Jim 2 5. Jane 2 6. Sue 3 7. Meg 3 Created a file “managers”: 1. Fred 2. Bill 3. Sally I want to print something like this: Fred Billy Fred Sally Fred Jim Billy Jane Billy Sue Sally Meg Sally

An awk way:


$ awk 'NR==FNR{a[$1]=$2;next} {print $2,a[$3"."]}' managers employees
Fred
Billy Fred
Sally Fred
Jim Bill
Jane Bill
Sue Sally
Meg Sally

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy f303668026ef28ce32633df5e1a6fce3