This post explains how to add a line at the beginning of a file from the terminal. But how do I modify from the terminal a line somewhere in a file if I do not know which line it is?
I should modify the line eni=10.*10**9
to eni=10.*10**8
note the exponents. It is the second time that eni
appears
I think this is what you want:
Since Ubuntu now ships with GNU Awk v4.0+ (which provides an
inplace
module) you could do something likeYou can make the regular expressions
/eni=/
and/or/10\*\*9/
more or less specific as required.Similarly in perl
Using sed:
/
is one of the delimiters and\
is the escape character.\
is used so that bash won't interpret special characters as some command, like*
as wildcard.