output data alignment.
Posted: 04 Jan 2014 03:00
I have below script and i am able to get the required info. but the string sizes are different in the output. so that i want to print the output in a grid format like as follows. could some one please advice me to print the output in grid format.
ASDF | 67 | ujuhh
QWEDD | 54 | jhj
@echo off
setlocal EnableDelayedExpansion
echo ---------------------------------------------------------------------------
echo Queue ^| type ^|put ^| get ^|Maxdepth^|cudepth^|usage
echo ----------------------------------------------------------------------------
set details=
echo "display ql(*)" | runmqsc QMGR > output.txt
for /F "delims=" %%a in (output.txt) do (
set details=!details!%%a
set property=%%a
if "!property:usage=!" neq "!property!" (
for /F "tokens=1-14 delims=()" %%a in ("!details!") do (
echo %%b^|%%d^|%%f^|%%h^|%%j^|%%l^|%%n
)
set details=
)
)
it should be like a perfect table of contents.
Queue length max 48 chars like type 6 , put 8 maxdepth 7 curdepth 7 usage 7 chars
---------------------------------------------------
Queue -------------------------|type--|put----| get--- |Maxdepth|cudepth|usage
----------------------------------------------------------------------------
system.jdfkjdhfkdj.khkdhfkd------|LOCAL|enabled|enabled|10000----|100----|NORMAL
kjhfksjdfhdkfjhkdsfjds_2323.sdjj---|LOCAL|enabled|disabled|10000----|100----|NORMAL
ASDF | 67 | ujuhh
QWEDD | 54 | jhj
@echo off
setlocal EnableDelayedExpansion
echo ---------------------------------------------------------------------------
echo Queue ^| type ^|put ^| get ^|Maxdepth^|cudepth^|usage
echo ----------------------------------------------------------------------------
set details=
echo "display ql(*)" | runmqsc QMGR > output.txt
for /F "delims=" %%a in (output.txt) do (
set details=!details!%%a
set property=%%a
if "!property:usage=!" neq "!property!" (
for /F "tokens=1-14 delims=()" %%a in ("!details!") do (
echo %%b^|%%d^|%%f^|%%h^|%%j^|%%l^|%%n
)
set details=
)
)
it should be like a perfect table of contents.
Queue length max 48 chars like type 6 , put 8 maxdepth 7 curdepth 7 usage 7 chars
---------------------------------------------------
Queue -------------------------|type--|put----| get--- |Maxdepth|cudepth|usage
----------------------------------------------------------------------------
system.jdfkjdhfkdj.khkdhfkd------|LOCAL|enabled|enabled|10000----|100----|NORMAL
kjhfksjdfhdkfjhkdsfjds_2323.sdjj---|LOCAL|enabled|disabled|10000----|100----|NORMAL