string - shell script find and replace in file -


I have a post postmaster.log, in which I need to find the pattern and change the value that changes.

  MaxValue = 3 # It can not be any value for 3   

  MaxValue = 0   

There is a problem like

  "MaxValueSet = 3" and "MaxValue is currently low"   

Are there. I have only changed MaxValue = 3 to MaxValue = 0, I tried to use

  sed -i 's / maxValue = 3 / MaxValue = 0 / g but it works only if If for any other value MaxValue = 3 it will not work.   

You can also work lines on sed :

  sed -i '/ ^ ^ MaxValue = / S / = [[: number:]] [[: digit:]] * / = 0 /' / home / postmaster.lag  < / Pre>  

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -