由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - [转载] 简单问题 -- about shell script
相关主题
为什么我就是不会写Shell script?hwo to solve it
[转载] a question about shell scriptAWK problem, SOS!
shell script for "for" loopbash programming problem on string
shell script question求平均值--unix command
求助一个shell scripthow to extract data every 20 lines.
请教:有关位置参数的问题。请问在unix命令窗口中英文乱码是怎么回事啊?
菜鸟问题-about shell programmingUNIX上的nobody的环境变量是否可以设置? 该如何设置?
help on extract email address from txt file如何显示出“*”
相关话题的讨论汇总
话题: x1话题: shell话题: script话题: x2话题: 变量
进入Unix版参与讨论
1 (共1页)
l*j
发帖数: 336
1
【 以下文字转载自 Linux 讨论区 】
【 原文由 lxj 所发表 】
初学shell script, 向各位请教,
有一不规则文本文件,中间有多个变量,例如 X1, X2,...
还有值与这些变量有关, 如 1000*X1, 500+X2等,
用空格或TAB分离开,
问题是,如果我知道X1的值,例如X1=3.1415926,
想替换该文件中的X1变量,并且在相应的位置上算出表达式的值,
如1000*X1的地方,就用3141.5926代替,等等,
我用 cat sourcefile | sed 's/X1/3.1415926/g' 可以替换
所有的X1,但是,不知道怎么expr,而且放在原来的位置上。 :)
请指教,
1 (共1页)
进入Unix版参与讨论
相关主题
如何显示出“*”求助一个shell script
.exrc无效请教:有关位置参数的问题。
[转载] debug不能监视某些变量的值?菜鸟问题-about shell programming
请问如何用awk修改文件里的内容?help on extract email address from txt file
为什么我就是不会写Shell script?hwo to solve it
[转载] a question about shell scriptAWK problem, SOS!
shell script for "for" loopbash programming problem on string
shell script question求平均值--unix command
相关话题的讨论汇总
话题: x1话题: shell话题: script话题: x2话题: 变量