I am having trouble with the cut command in linux. So say the original data looks something like this:
4567 Harrison Joel Accountant
Mitchell Barbara Admin
3589 Olson Timothy Supervisor
4591 Moore Sarah Dept
Note that in row 2, it is missing the value for the first column (so only has three fields instead of four).
When I run the following command:
$ awk '{print $3,$4,$5,$8}' data.txt |column -t
I get:
4567 Harrison Joel Accountant
Mitchell Barbara Admin
3589 Olson Timothy Supervisor
4591 Moore Sarah Dept
What I would like is this:
4567 Harrison Joel Accountant
Mitchell Barbara Admin
3589 Olson Timothy Supervisor
4591 Moore Sarah Dept
In other words, I want the columns to stay consistent after I perform the tab separation. So it's clear which column corresponds to first name, last name, description, etc.
Is there a good way to do this?