My file has a line like this
integer, parameter :: L = 2! The size of the system
can be any integer number where the number 2
is to use this code sed
and with the other The value of the number is to change.
I tried:
$ L = 5 $ i '/ l = / c \ integer, parameter :: l = $ l! System size 'sed moduleselfcons.f90
But in my modified file I have
integer, parameter :: L = $! System size
no more:
integer, parameter :: L = 5! System size
What's the problem?
You should use double quotation marks ( "
) of single quotes Instead ( '
).
But I think you can shorten the expression:
L = 5 sed "s / l = [0-9] * / l = $ l / "file
If it is yours add -i
flag to the desired output in-place editing. < / P>
Comments
Post a Comment