1
如何对齐此脚本输出。外壳输出对齐
for instance in `find /bxp/*/*/*/prod/*/apache_*/httpd/htdocs/ -type f -name status.txt` ; do
echo "`hostname`: `ls -ltr | ${instance}` : `cat ${instance}`"
done
输出的样子:
r008abc, /bxp/xip/xip.pentaho-server_pentaho-server-assembly/pentaho.prod.jobengine/prod/xip.pentaho-server_web.partition_0.0.1/apache_5.3.3-2.2.
26/httpd/htdocs/status.txt, Web server is disabled
但是我想要的输出如:
r008abc| xip - xip.pentaho-server_web.partition_0.0.1 | Web server is disabled
XIP - 不过是$实例的第二列 - xip.pentaho- server_web.partition_0.0.1是$实例的第6列。我怎样才能做到这一点。我尝试过awk命令,但没有帮助。你的建议表示赞赏。
命令我试过
for instance in `find /bxp/*/*/*/prod/*/apache_*/httpd/htdocs/ -type f -name status.txt` ; do
echo "`hostname`: `"ls -ltr | awk -F '/' '{print $3}"' ${instance}` : `cat ${instance}`"
done
这只是Awesome..Thanks。我几个小时都在为此而头痛。 – Satte
将输出更改为适当的列。 –
是的,我已经完成了。谢谢 – Satte