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