Command output formatting
Posted: 16 Aug 2023 01:00
Hi,
I have to produce command output on Windows machine on similar way that I can produce it on Linux machine.
Command is:
And its output on Windows machine is:
I can format it on Linux machine so it looks nicer with command:
And output looks like:
Is there any way that this nicer formatting of command output can be done on Windows machine?
Regards.
I have to produce command output on Windows machine on similar way that I can produce it on Linux machine.
Command is:
Code: Select all
crsctl stat res -t
Code: Select all
C:\Users\Administrator>crsctl stat res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
ONLINE ONLINE win2008
ora.FRA.dg
ONLINE ONLINE win2008
ora.LISTENER.lsnr
ONLINE ONLINE win2008
ora.asm
ONLINE ONLINE win2008 Started
ora.ons
OFFLINE OFFLINE win2008
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
1 ONLINE ONLINE win2008
ora.evmd
1 ONLINE ONLINE win2008
ora.finnew.db
1 OFFLINE OFFLINE
Code: Select all
crsctl status res |grep -v "^$"|awk -F "=" 'BEGIN {print " "} {printf("%s",NR%4 ? $2"|" : $2"\n")}'|sed -e 's/ *, /,/g' -e 's/, /,/g'|\
awk -F "|" 'BEGIN { printf "%-40s%-35s%-20s%-50s\n","Resource Name","Resource Type","Target ","State" }{ split ($3,trg,",") split ($4,st,",")}{for (i in trg) {printf "%-40s%-35s%-20s%-50s\n",$1,$2,trg[i],st[i]}}'
Code: Select all
Resource Name Resource Type Target State
ora.DATA.dg ora.diskgroup.type ONLINE ONLINE on oracle-linux-test-vm
ora.FRA.dg ora.diskgroup.type ONLINE ONLINE on oracle-linux-test-vm
ora.LISTENER.lsnr ora.listener.type ONLINE ONLINE on oracle-linux-test-vm
ora.asm ora.asm.type ONLINE ONLINE on oracle-linux-test-vm
ora.cssd ora.cssd.type ONLINE ONLINE on oracle-linux-test-vm
ora.diskmon ora.diskmon.type OFFLINE OFFLINE
ora.evmd ora.evm.type ONLINE ONLINE on oracle-linux-test-vm
ora.ons ora.ons.type OFFLINE OFFLINE
ora.testdb.db ora.database.type ONLINE ONLINE on oracle-linux-test-vm
Regards.