编写shell脚本处理test文件,如下内容
得到结果:
http://bba.autlo.com/index.html
http://Ucar.autlo.com/index.html
http://Beijing.autlo.com/index.html
方法一:
awk -F "/" '{OFS="/"}{ $0~/^http:/;$4="index.html";print $0 }' test
方法二:
sed 's/autlo.com\/$/autlo.com\/index.html/' test
方法三:
sed 's/\(.*\)/\1index.html/' test
转载于:https://blog.51cto.com/198293/1337446