2
1
I want to change a cell in file when my desired state exists. Example:
File:
id311 vmName1 state0
id312 vmName2 state0
id313 vmName3 state0
I will type a script and this script changes the state column of just one row. So if I type sed -i 's/state0/state1/g'
all state0
's be state1
. I want to change state of only one row like:
File:
id311 vmName1 state0
id312 vmName2 state1
id313 vmName3 state0
How can I use the sed
command for a special line with use id?
note: id's are unique.
Thanks but it doesn't change the file I think so. I want to change line in the file. – Gefolge – 2017-08-11T08:36:47.957
1@A.Guven just place the
-i
as your attempt shows. – fedorqui – 2017-08-11T08:37:10.330Well, how can I use this with a variable like $lineNumber? – Gefolge – 2017-08-11T08:39:41.557
1@A.Guven see update. – fedorqui – 2017-08-11T08:42:12.577