shell中向sed命令传递变量

shell中向sed命令传递变量

标签: shellnewlin     http://blog.csdn.net/yizhizouxiaqu/article/details/7367520
7369人阅读 评论(0) 收藏 举报
分类:
linux(7)
作者同类文章 X

使用shell中的sed命令时,发现不能把shell定义的变量传递进去,

shell命令如下:

sed -n ’${fileLength[$j]},$newline p‘ ${fileName[$j]} >> all.log

发现只需要将sed -n '${fileLength[$j]},$newline p' ${fileName[$j]} >> all.log

中的单引号,改成双引号就可以了。

sed -n "${fileLength[$j]},$newline p" ${fileName[$j]} >> all.log


awk中传递变量

http://junlee.blog.51cto.com/228061/545493

你可能感兴趣的:(linux,shell)