LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   sed to change some values in a file permanently (https://www.linuxquestions.org/questions/linux-general-1/sed-to-change-some-values-in-a-file-permanently-629784/)

tanveer 03-21-2008 10:13 PM

sed to change some values in a file permanently
 
Hi,
I have a file where I there are some 1500 lines and in there I want to change some values. For that I am using sed like below:

PHP Code:

cat /home/test.css grep "network.type” | sed –i ‘s/0/1/’ 

Now the problem is it changes the lines in file but how to make it permanent and if I use sed with -i option then I have to provide the file name with it but I am using grep to grep the line.

Any clue please.

syg00 03-21-2008 10:22 PM

You don't need cat, nor grep - use sed's address facility (see the manpage). Something like this
Code:

sed -i /network.type/s/0/1' test.css

tanveer 03-23-2008 01:17 PM

Thanks a lot. just what I was looking for.


All times are GMT -5. The time now is 06:34 PM.