SUSE Linux iTOps Tube

Monday, May 7, 2012

Help with Awk and Printf, please!

Hi guys. I need help with getting a file to give me a certain output using the awk command, please.

I have this file that has the following format:


I need an output that is going to be like this:

LastName, FirstName MI SalesID

NOTE: all 3 names have to fit into a 25 character container and the SalesID needs to be right alligned. SalesID is a number.

So far, here is what I have.

I have a file called "salespeople" with data in a format I described above.

the command I have so far is:

awk -F: '{printf "%s, %-s %-s %d\n", $2, $3, $4, $1}' salespeople

Please tell me what I'm doing wrong. This is kind of urgent too.

Thanks in advance!

No comments:

Post a Comment