ecasadella
MIS
I have a file with this content
Parameter: NSTRBLKSCHED
Current: -
Planned: 2
Default: 2
Minimum: -
Module: -
Version: -
Dynamic: No
Parameter: NSTREVENT
Current: 50
Planned: 50
Default: 50
Minimum: -
Module: -
Version: -
Dynamic: No
and i want to assign the values after the first column to a variable and then print them into a single row, so far I could get this
cat file | grep -v "^$" | awk '
/Parameter:/ {param=$2}
/Current:/ {curr=$2}
/Planned:/ {plan=$2}
/Default:/ {def=$2}
/Minimum:/ {min=$2}
/Module:/ {mod=$2}
/Version:/ {ver=$2}
/Dynamic:/ {dyn=$2}
{ printf ( "%s %s %s %s %s %s %s %s\n",
param,curr,plan,def,min,mod,ver,dyn)
}'
but I want to avoid the repetition that I get on the output.
NSTRBLKSCHED
NSTRBLKSCHED -
NSTRBLKSCHED - 2
NSTRBLKSCHED - 2 2
NSTRBLKSCHED - 2 2 -
NSTRBLKSCHED - 2 2 - -
NSTRBLKSCHED - 2 2 - - -
NSTRBLKSCHED - 2 2 - - - No
NSTREVENT - 2 2 - - - No
NSTREVENT 50 2 2 - - - No
NSTREVENT 50 50 2 - - - No
NSTREVENT 50 50 50 - - - No
NSTREVENT 50 50 50 - - - No
NSTREVENT 50 50 50 - - - No
NSTREVENT 50 50 50 - - - No
NSTREVENT 50 50 50 - - - No
Any suggestions?
EDC
--------------------------------------
This is Unix-Land. In quiet nights, you can hear the Windows machines
reboot.
Parameter: NSTRBLKSCHED
Current: -
Planned: 2
Default: 2
Minimum: -
Module: -
Version: -
Dynamic: No
Parameter: NSTREVENT
Current: 50
Planned: 50
Default: 50
Minimum: -
Module: -
Version: -
Dynamic: No
and i want to assign the values after the first column to a variable and then print them into a single row, so far I could get this
cat file | grep -v "^$" | awk '
/Parameter:/ {param=$2}
/Current:/ {curr=$2}
/Planned:/ {plan=$2}
/Default:/ {def=$2}
/Minimum:/ {min=$2}
/Module:/ {mod=$2}
/Version:/ {ver=$2}
/Dynamic:/ {dyn=$2}
{ printf ( "%s %s %s %s %s %s %s %s\n",
param,curr,plan,def,min,mod,ver,dyn)
}'
but I want to avoid the repetition that I get on the output.
NSTRBLKSCHED
NSTRBLKSCHED -
NSTRBLKSCHED - 2
NSTRBLKSCHED - 2 2
NSTRBLKSCHED - 2 2 -
NSTRBLKSCHED - 2 2 - -
NSTRBLKSCHED - 2 2 - - -
NSTRBLKSCHED - 2 2 - - - No
NSTREVENT - 2 2 - - - No
NSTREVENT 50 2 2 - - - No
NSTREVENT 50 50 2 - - - No
NSTREVENT 50 50 50 - - - No
NSTREVENT 50 50 50 - - - No
NSTREVENT 50 50 50 - - - No
NSTREVENT 50 50 50 - - - No
NSTREVENT 50 50 50 - - - No
Any suggestions?
EDC
--------------------------------------
This is Unix-Land. In quiet nights, you can hear the Windows machines
reboot.