Skip to main content

Here is the sample of the codean example of what my intent is for such a scriptI am trying to do:

#!/bin/bash
Update=$1

if [$Update == Value] 
then
    NewValue= $Update
    vi %s/Value/$NewValue/g > Updatedfile
fi
exit 0

Is there a way to utilize vi commands within a script? My thoughts are that some type of piping would do this?

Here is the sample of the code of what my intent is for such a script:

#!/bin/bash
Update=$1

if [$Update == Value] 
then
    NewValue= $Update
    vi %s/Value/$NewValue/g > Updatedfile
fi
exit 0

Is there a way to utilize vi commands within a script? My thoughts are that some type of piping would do this?

Here is an example of what I am trying to do:

#!/bin/bash
Update=$1

if [$Update == Value] 
then
    NewValue= $Update
    vi %s/Value/$NewValue/g > Updatedfile
fi
exit 0

Is there a way to utilize vi commands within a script? My thoughts are that some type of piping would do this?

specifiying the question to specific scenario
Link
Juan Davila
  • 145
  • 1
  • 5
  • 15

How to edit a file from a script using a loop instead of find and replace with sed?

Post Closed as "Duplicate" by jasonwryan, Stephen Kitt, Anthon, G-Man Says 'Reinstate Monica', don_crissti
fix indents and script errors -- you realy should test your scripts before posting
Source Link
ctrl-alt-delor
  • 28.8k
  • 11
  • 66
  • 113

Here is the sample of the code of what my intent is for such a script:

#!/bin/bash
Update=$1

if [Update[$Update == Value] 
then
NewValue = Update  NewValue= $Update
    vi %s/Value/$NewValue/g > Updatedfile
fi
exit 0

Is there a way to utilize vivi commands within a script? My thoughts are that some type of piping would do this?

Here is the sample of the code of what my intent is for such a script:

#!/bin/bash
Update=$1

if [Update == Value] 
then
NewValue = Update
vi %s/Value/$NewValue/g > Updatedfile
fi
exit 0

Is there a way to utilize vi commands within a script? My thoughts are that some type of piping would do this?

Here is the sample of the code of what my intent is for such a script:

#!/bin/bash
Update=$1

if [$Update == Value] 
then
    NewValue= $Update
    vi %s/Value/$NewValue/g > Updatedfile
fi
exit 0

Is there a way to utilize vi commands within a script? My thoughts are that some type of piping would do this?

Source Link
Juan Davila
  • 145
  • 1
  • 5
  • 15
Loading