Align with printf or other method

below line is one by one print

audio_play               PASS
boot_check                FAIL
ethernet_change_mac         NIC_82574L  PASS
gps_ublox_neo               FAIL
storage_bonnie              USB2        PASS
storage_copy_big_file      USB2        PASS


I would like below format

audio_play                               PASS
boot_check                               FAIL
ethernet_change_mac      NIC_82574L      PASS
gps_ublox_neo                            FAIL
storage_bonnie           USB2            PASS
storage_copy_big_file    USB2            PASS


Printed by what?

This is not easy unless the data you have is delimited or fixed length

You can easily convert from 1 step above

Straightforward approach:

awk 'NF==3{printf "%-25s%-15s%s\n",$1,$2,$3; next}{printf "%-40s%s\n",$1,$2}' file
1 Like

by "printf" with line by line or other method , but I don't know how to

column -t file

What I meant is modify the script/program that prints the output in the first place instead of correcting the output afterwards. Slight modification of Scrutinizer's proposal:

awk 'NF<3{$3=$2;$2=""} {printf "%-25s%-15s%s\n",$1,$2,$3}' file
audio_play                              PASS
boot_check                              FAIL
ethernet_change_mac      NIC_82574L     PASS
gps_ublox_neo                           FAIL
storage_bonnie           USB2           PASS
storage_copy_big_file    USB2           PASS

Can you post what you have...