Tab character in shell giving different width
You can use the printf
in awk
to adjust column width etc:
awk '{printf "%s %s %-20s %s %s\n",$1,$2,$3,$4,$5}' fileMr. James Adams General ManagerMr. James Adams General ManagerMr. James Carleo Branch ManagerMr. James Cobb Branch ManagerMr. James Collier Branch ManagerMr. James K. Cross Sr.ViceMr. James Cummings Branch ManagerMr. "James ""Jamie""" Dyer BranchMr. James (Danny) Farris ManagerMr. James N. Martin GeneralMr. James N. Martin GeneralMr. James Ogden Branch ManagerMr. James Wilson Branch Manager
The tab character goes to the next tabstop after the current cursor Position. That means the end point depents on the length of names already filtered. If you want fixed-size fields I suggest you use printf
to fix the size of the name column. See http://www.gnu.org/software/gawk/manual/html_node/Printf-Examples.html for documentation.
Pipe awk output with column
:
awk '{print $1,$2,$3,"\t",$4,$5}' file|column -ts$'\t'