Formatted output - awk

Hi

I have the following records in a file

SABN YOURTUBE 000514 7256
SACN XYOUDSDF 000514 7356
SADN KEHLHRSER 000514 7656
SAEN YOURTUBE 000514 7156
SAFN YOURTUBE 000514 7056

I need to put this in the format like this

printf '%s %-50s %6s %-6s\n'
I am not going to read individual lines and do a printf as the processing time taken is in hours which is not expected.

I would like to cut the entire column 1,2,3,4 and output in the printf format given above.
Any examples would be appreciated.

Regards
Dhana

Do you mean that the processing time is very slow in awk, or reading individual lines by some other method? Can you show us your code?

awk has printf built-in, so I don't understand what exactly you need help with.

Hi

I have been reading individual lines of the file using sed and
cutting the columns that i need and using

printf '%s %-50s %6s %-6s %s\n'

I was able to achieve my things. But i am reading a 1 GB file and the processing of these steps was more and going for hours as i am reading each line.

So.. i thought of removing the whole individual columns itself and print the column output in the above printf format.

As this will not read each line and processing would be fast.

Let me know if you need more information.

Regards
Dhana

As I said, awk has a printf built-in to it. Read the man page.