Q:

how to align contect in column file

i have a list of processes with the following content:
avahi- daemon 

S (sleeping)

753

1

115

122

The first line is the name of the process , the second is the state, third the pid and then PPID,UID,GID respectively.
This list has been extracted using the following command:
awk  -F":" 'NR==1 {print $2} NR==6 {print $2} NR==7 {print $2} NR==9 {print $2} NR==10 {print $2} NR==3 {print $2}' /proc/PID/status

i would like to align this content and have an output in columns like this for all the processes:
Name PID PPID UID GID STATE

A:

You can easily refactor your Awk script to produce the desired format.
awk  -F":" 'NR==1 {name=$2}
  NR==3 {state=$2}
  NR==6 {pid=$2}
  NR==7 {ppid=$2}
  NR==9 {uuid=$2}
  NR==10 {gid=$2
    print name, pid, ppid, uid, gid, state }' /proc/PID/status

If you want tab-delimited output, add -v ORS="\t" before the -F option.

