以下是我寫處理從一個字符串數組通配符擴展在bash shell腳本
line="/path/IntegrationFilter.java:150: * <td>http://abcd.com/index.do</td>"
echo "$line" <-- "$line" prints the text correctly
result_array=(`echo "$line"| sed 's/:/\n/1' | sed 's/:/\n/1'`)
echo "${result_array[0]}"
echo "${result_array[1]}"
echo "${result_array[2]}" <-- prints the first filename in the directory due to wildcard character * .
如何獲取文本的示例腳本「* http://abcd.com/index.do」從數組中檢索時打印而不是文件名?
它適用於我,我將使用第二種解決方案。感謝Mikel! – ranjit 2011-04-13 06:18:57