shell切分字符串到数组 问题: 对于’aa,bb,cc,dd,ee’这样的字符串输出采用,分隔开的aa bb cc dd ee aa:bb is ok:/home/work按照":"分割开来的aa bb is ok /home/work 解决方法1: #!/bin/bash var=’aa,bb,cc,dd,ee’ var=${var//,/ } #这里是将var中的,替换为空格 for element in $var do echo $element done…
Reference: http://saiyaren.iteye.com/blog/1943207 1. Shell 读取文件和写文件 for line in $(<top30000.url.utf-8.http_server_front_hphp.txt); do tmp_port=8080; for((i=0;i<=7;i++));do echo ${line/192\.168\.12\.63/192\.168\.12\.63:$tmp_port} >>top3000…