Replace a word that in a pattern with sed

May 3, 2013 at 06:30:04
Specs: Windows 7
I have a string that I greped from a file and need to edit the file to replace a specific work in that pattern with another one.This is what I have
I used grep someapp.disable myfile.xml
I get
<data key='user.com.....someapp.disable' value='true'/>
I need to grep this line from a file and replace true with false.

I appreciate any help I can get


See More: Replace a word that in a pattern with sed

Report •

#1
May 3, 2013 at 07:01:23
#!/bin/ksh

echo "<data key='user.com.....someapp.disable' value='true'/>"| sed 's/true/fals
e/g'

Replace the echo ... with your grep command.


Report •

#2
May 3, 2013 at 08:35:56
Thanks nails for your reply. The command you gave me did not work because sed kept complaining about the char in that string so I had to grep it then echo it with "". The issue now it is replacing all the false values in that file to true.

EnableServer=`grep appserver.disable $File`
echo "$EnableServer"| sed -i 's%false%true%' $File


Report •
Related Solutions


Ask Question