I have a function in my script and i need it to display the output on a table with a header and hide the ligne that contain RELEASE on the output.
for file in ${list[@]}; do
echo -ne ${file} ${ins} " "; env | grep -i ${file} | cut -f2 -d"="
done
here's the outpuit i get right now :
comp1 installed ! v0.6.2
comptest1 installed ! v2.1.1
comp2 installed ! v2.1.5
comp3 installed ! v0.12.0
1.1.18-RELEASE
comp4 installed ! v0.7.0
expected outpout :
Component status version
comp1 installed ! v0.6.2
comptest1 installed ! v2.1.1
comp2 installed ! v2.1.5
comp3 installed ! v0.12.0
comp4 installed ! v0.7.0
what i've tried :
i tried something like redirecting the output of the echo commant to a temp file and then using
column -t -s "," -o "||" temp.txt
But i didn't work i keep getting errors like No such file or directory.
I tried using printf and awk too
awk '{printf "%-30s|%-18s|%-20s\n",${file},${ins} " "; env | grep -i ${file} | cut -f2 -d"="}'
It didn't work too i keep getting syntax errors.
printf
? – mustacciodeclare -p list
to your question. – Cyrus