bash - (AWK) Creating a username column using the characters from first name and last name columns -
After trying to achieve the output of a new column after the last, which is the first letter of the first name and the rest Uses the last name. Vincent Nguyen David Pham Bobby Hill
You can:
awk '{print $ 0, tolower (substr ($ 1,1,1) $ NF)} 'file Vincent Nguyen vnguyen David Pham dpham Bobby Hill bhill
Some can be reduced: (but Less robust)
awk '$ 0 = $ 0FS tolower (substr ($ 1,1,1) $ NF)' file
Updated to support more names:
Bobby B Gigut Hill gives
Bobby Bigfoot Hill Billy
Comments
Post a Comment