您的位置:首页 > 运维架构 > Shell

shell中使用sed替换指定位置的字符

2011-12-06 21:48 1321 查看
#!/bin/sh

read str

read index

read replace

index = `expr $index - 1`

echo $str | sed 's/\([a-zA-Z0-9]\{'$index'\}\)\(.\)\(.*\)/\1'$replace'\3/'
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: