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

Vincent Nguyen vnguyen David Pham dpham Bobby Hill bhill

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

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -