not sure what '29 spaces from the extreme left' means, but here's a start:
29 spaces from left and not from the end character of last name.
Now coming to back to script, I will try what you have suggested but I also need to do it for other lines in the files so some loop will be required further I guess.
EDIT 1,
manual command is working fine, now we will need a loop to take care of all lines in the file, thank you!
EDIT 2,
I tried below,
while read LINE; do awk '{print $1 $2" "$3}'|awk -F, '{split($2,a, " "); printf(" %s,%-*s%s\n", $1, 29-length(a[2]),a[1],a[2])}'; done < hmm.txt
where hmm.txt contains the "firstname, lastname Number" on every line.
Problem with the output I get from above script is that the "Number" gets positioned at 29 spaces after last name instead I want it from 29 spaces from the beginning of the line
Any help?
this is cool. but again I want Number to be 29 places from the beginning of that line and not from 29 spaces from last name. Sorry, if I wasn't clear in the first place.
Awsome. thanks so much. This worked fine. Now I have issues with some lines where there exists a terribly long first or last name but I 'll take responsibility to take care of that
One idea would be to parse the file TWICE.
In the first pass figure out the maximum lengths for the firstname and the lastname fields.
In the second pass format the lines aligning the the last field (B20000 in you example) according to the firstname/lastname maximum lengths.